Open Piscinelove opened 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
Environment
Build Modules: -
Reproduction
The error only occurs in production after running :
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 :
I traced the error back to its source
If I understand correctly,
v3.0.0-rc.4
uses versionv3.8.2
of@nuxt/kit
v3.0.0
uses versionv3.9.1
of@nuxt/kit
.installModule
function inv3.9.1
depends on the contents of thenuxt.options._layers
property. L19nuxt.options._layers
property is mocked by@nuxt/bridge
but only indev
environment or during thebuild
process. L61nuxt.options._layers
property isundefined
when the server is started.Proposed solution:
buildModules
function.Additional context
No response
Logs
No response