sitemap-module icon indicating copy to clipboard operation
sitemap-module copied to clipboard

fix: Cannot read property 'filter' of null on Zeit

Open adesege opened this issue 5 years ago • 3 comments

routes is null when using @nuxtjs/now-builder on Zeit. This fix sets an empty array when the variable null.

adesege avatar Dec 31 '19 22:12 adesege

Codecov Report

Merging #95 into dev will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            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.

codecov[bot] avatar Dec 31 '19 22:12 codecov[bot]

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 avatar Feb 24 '20 23:02 NicoPennec

@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.

adesege avatar Jul 01 '20 18:07 adesege