harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
1.02k stars 62 forks source link

Build warning when using useSiteConfig on Nitro #274

Open ronenteva opened 1 month ago

ronenteva commented 1 month ago

Describe the bug

After adding const siteConfig = useSiteConfig(event) on a server route, I keep getting this error on build:

Export "useSiteConfig" of module "node_modules/.pnpm/nuxt-site-config@2.2.15_magicast@0.3.4_rollup@4.18.1_vite@5.3.4_@types+node@20.14.11_sass@1.7_ugbbsadflybmnnuzwmc5llzr2y/node_modules/nuxt-site-config/dist
/runtime/nitro/composables/useSiteConfig.js" was reexported through module "node_modules/.pnpm/nuxt-site-config@2.2.15_magicast@0.3.4_rollup@4.18.1_vite@5.3.4_@types+node@20.14.11_sass@1.7_ugbbsadflybmnnuzwmc
5llzr2y/node_modules/nuxt-site-config/dist/runtime/nitro/composables/index.js" 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 "server/api/example.js" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.

Reproduction

No response

System / Nuxt Info

- Operating System: Linux
- Node Version:     v20.15.1
- Nuxt Version:     3.12.3
- CLI Version:      3.12.0
- Nitro Version:    2.9.7
- Package Manager:  pnpm@9.5.0
- Builder:          -
- User Config:      extends, modules, router, routeRules, robots, site, sitemap, app, nitro, colorMode, devtools, i18n, rollbar, scripts, tailwindcss, future
- Runtime Modules:  @nuxt/scripts@0.6.4, @nuxt/ui@2.17.0, @nuxtjs/device@3.1.1, @nuxtjs/html-validator@1.8.2, @nuxtjs/i18n@8.3.1, @nuxtjs/seo@2.0.0-rc.15, @pinia/nuxt@0.5.1, @vueuse/nuxt@10.11.0
- Build Modules:    -
harlan-zw commented 1 month ago

Hi, could you confirm how you're importing it? Are you just relying on the auto-imports?

In any case, this is safe to ignore, I'll try and fix it as I understand these warnings aren't ideal.

ronenteva commented 1 month ago

Yes, just relying on the auto-imports. Thanks!

bernhardberger commented 4 weeks ago

Same issue (I'm using it in my sitemap routes):

Export "useSiteConfig" of module "node_modules/nuxt-site-config/dist/runtime/nitro/composables/useSiteConfig.
js" was reexported through module "node_modules/nuxt-site-config/dist/runtime/nitro/composables/index.js" whi
le 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 "server/api/__sitemap__/filterpages.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.