nuxt-community / sitemap-module

Sitemap Module for Nuxt 2
https://sitemap.nuxtjs.org
MIT License
690 stars 128 forks source link

sitemap conflicts with latest nuxt-i18n #157

Closed miteyema closed 4 years ago

miteyema commented 4 years ago

Version

2.4.0

Reproduction link

https://github.com/miteyema/nuxt-i18n-demo

Steps to reproduce

What is expected ?

nuxt app builds successfully

What is actually happening?

nuxt app fails to build

Additional comments?

 ERROR  router.forEach is not a function                                                                                                          

  at flattenStaticRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:38:10)
  at getStaticRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:26:10)
  at Object.<anonymous> (node_modules/@nuxtjs/sitemap/lib/module.js:31:32)
  at Object.extendRoutes (node_modules/@nuxt/utils/dist/utils.js:1868:25)
  at Builder.resolveRoutes (node_modules/@nuxt/builder/dist/builder.js:5881:56)
  at async Promise.all (index 1)
  at async Builder.generateRoutesAndFiles (node_modules/@nuxt/builder/dist/builder.js:5710:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:5635:5)
  at async Object._buildDev (node_modules/@nuxt/cli/dist/cli-dev.js:106:5)
  at async Object.startDev (node_modules/@nuxt/cli/dist/cli-dev.js:64:7)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-dev.js:51:5)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:2810:7)
This bug report is available on Nuxt community (#c115)
rchl commented 4 years ago

Should be fixed in nuxt-i18n (https://github.com/nuxt-community/i18n-module/commit/c0d136b83a4998926500ed90e34c4223f98034b9) Apparently Nuxt doesn't support async functions for extendBuild. Or it does if there is only a single module using extendBuild...

NicoPennec commented 4 years ago

thanks @rchl for your quick fix 🙏

@miteyema can you confirm that the issue for the sitemap module is solved?

pi0 commented 4 years ago

Apparently Nuxt doesn't support async functions for extendBuild. Or it does if there is only a single module using extendBuild...

@rchl Do you mind making a bug report on nuxt for this?

rchl commented 4 years ago

@pi0 Filed https://github.com/nuxt/nuxt.js/issues/8037

miteyema commented 4 years ago

@NicoPennec With the bug fix update of @pi0 , all seems to work again. Thanks again for the very fast solution guys!