nuxt / bridge

🌉 Experience Nuxt 3 features on existing Nuxt 2 projects
MIT License
272 stars 30 forks source link

nuxt.options._layers is not iterable in v3.0.0 #1067

Open Piscinelove opened 10 months ago

Piscinelove commented 10 months ago

Environment


Reproduction

Edit currying-tdd-4qddcj

The error only occurs in production after running :

yarn build
yarn start

Describe the bug

I am in the process of updating a module in our company from v3.0.0-rc.4 to v3.0.0

We're not using nitro and vite yet, as we still have some work to do.

Our module installs other modules using installModule function from @nuxt/kit.

The following error occurs when launching the server after a production build :

yarn run v1.22.19
$ nuxt2 start

 ERROR  nuxt.options._layers is not iterable                        7:37:51 PM

  at installModule (node_modules/@nuxt/kit/dist/index.mjs:2409:32)

I traced the error back to its source

If I understand correctly,

Proposed solution:

Additional context

No response

Logs

No response

wattanx commented 10 months ago

I think we should create an issue on upstream for this. https://github.com/nuxt/nuxt

Also, I think it is better to use @nuxt/kit with buildModules. In nuxt 3, modules are build-time-only. https://nuxt.com/docs/guide/concepts/modules#add-nuxt-modules https://nuxt.com/docs/migration/module-authors#avoid-runtime-modules