nuxt-modules / sitemap

Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.
https://nuxtseo.com/sitemap
MIT License
336 stars 31 forks source link

fix: warnings during build #340

Closed modbender closed 3 months ago

modbender commented 3 months ago

🐛 The bug

Simply run pnpm build in the given reproduction.

The warnings start point is during prerender When running in local I get the below:

ℹ Initializing prerenderer                                                                           

[9:03:34 PM]  WARN  Export "useNitroApp" of module "node_modules/.pnpm/nitropack@2.9.7_magicast@0.3.4/node_modules/nitropack/dist/runtime/app.mjs" was reexported through module "virtual:#imports" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
Either change the import in "node_modules/.pnpm/@nuxtjs+sitemap@6.0.0-beta.1_h3@1.12.0_magicast@0.3.4_rollup@4.20.0_vite@5.4.0_@types+node@22_szxcvtnyzcxkvhrbam3gebvwju/node_modules/@nuxtjs/sitemap/dist/runtime/nitro/routes/sitemap_index.xml.js" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.

Further warnings

[9:04:27 PM]  WARN  Export "useNitroApp" of module "node_modules/.pnpm/nitropack@2.9.7_magicast@0.3.4/node_modules/nitropack/dist/runtime/app.mjs" was reexported through module "virtual:#imports" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
Either change the import in "node_modules/.pnpm/@nuxtjs+sitemap@6.0.0-beta.1_h3@1.12.0_magicast@0.3.4_rollup@4.20.0_vite@5.4.0_@types+node@22_szxcvtnyzcxkvhrbam3gebvwju/node_modules/@nuxtjs/sitemap/dist/runtime/nitro/routes/sitemap_index.xml.js" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.

ℹ Prerendered 73 routes in 66.009 seconds                                                              
✔ Generated public .output/public                                                                      
ℹ Building Nuxt Nitro server (preset: node-server)                                                    
Export "useNitroApp" of module "node_modules/.pnpm/nitropack@2.9.7_magicast@0.3.4/node_modules/nitropack/dist/runtime/app.mjs" was reexported through module "virtual:#imports" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
Either change the import in "node_modules/.pnpm/@nuxtjs+sitemap@6.0.0-beta.1_h3@1.12.0_magicast@0.3.4_rollup@4.20.0_vite@5.4.0_@types+node@22_szxcvtnyzcxkvhrbam3gebvwju/node_modules/@nuxtjs/sitemap/dist/runtime/nitro/routes/sitemap_index.xml.js" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-7mnzr1?file=package.json

🌈 Expected behavior

Build successfully without errors or warnings.

ℹ️ Additional context

No response

urbgimtam commented 3 months ago

I'm getting the same during build.

Export "useNitroApp" of module "node_modules/nitropack/dist/runtime/app.mjs" was reexported through module "virtual:#imports" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
Either change the import in "node_modules/@nuxtjs/sitemap/dist/runtime/nitro/routes/sitemap_index.xml.js" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.

This issue may be related? https://github.com/nuxt/nuxt/issues/18789#issuecomment-1420047699

Anoesj commented 1 month ago

@harlan-zw Are you sure this is fixed? Running into this problem myself, so I tried the reproduction above but with 2.0.0-rc.23 and the same warning showed up again.

harlan-zw commented 1 month ago

Yes it is broken, the issue is upstream and will be resolved when Nitro moves to v3. You can ignore in the meantime or wait until I push up a temporary fix, it won't cause any issues.