sitemap-module
sitemap-module copied to clipboard
fix: Cannot read property 'filter' of null on Zeit
routes
is null when using @nuxtjs/now-builder on Zeit. This fix sets an empty array when the variable null.
Codecov Report
Merging #95 into dev will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## dev #95 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 261 261
Branches 57 58 +1
=========================================
Hits 261 261
Impacted Files | Coverage Δ | |
---|---|---|
lib/module.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1a1b277...ea35d72. Read the comment docs.
Thanks for your patch @adesege 🙏
But It seems not fix the root cause. Why the globalCache.staticRoutes
is empty here?https://github.com/nuxt-community/sitemap-module/blob/eaf25181eda4885c264e989a4b434b7a70a6878e/lib/generator.js#L42
I will investigate.
@NicoPennec globalCache.staticRoutes
will hold static site routes and since the package can be used for both statically and universally generated sites, line 25 returns error if it can't find the sitemap-routes.json file in the dist folder.
I have updated line 26 to default to an empty array instead.