nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
360 stars 23 forks source link

Circular Dependency Issue with useNitroApp Export in nuxt-og-image #178

Open daver987 opened 3 months ago

daver987 commented 3 months ago

I encountered a circular dependency issue while working with the nuxt-og-image module in my Nuxt project. The built projct is getting a runtime error.

Build Warning:

Export "useNitroApp" of module "node_modules/.pnpm/nitropack-nightly@2.10.0-28509108.fdf7e70/node_modules/nitropack-nightly/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.

Node.js v20.11.1

Environment:

Nuxt Version: 3.11 nightly nuxt-og-image Version: 3.0.0-rc.45 nitropack-nightly Version: 2.10.0-28509108.fdf7e70 Node Version: 20.11.1

Error:

node:internal/modules/esm/resolve:853 throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null); ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'nitropack' imported from /app/.output/server/index.mjs at packageResolve (node:internal/modules/esm/resolve:853:9) at moduleResolve (node:internal/modules/esm/resolve:910:20) at defaultResolve (node:internal/modules/esm/resolve:1130:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38) at ModuleWrap. (node:internal/modules/esm/module_job:85:39) at link (node:internal/modules/esm/module_job:84:36) { code: 'ERR_MODULE_NOT_FOUND' }

Node.js v20.11.1

Expected Behavior: The application should correctly resolve and load nitropack as a dependency without throwing runtime errors, allowing the nuxt-og-image module to function as intended.

Actual Behavior: A runtime error is thrown indicating that the nitropack module cannot be found, leading to a failure in the application's execution.