fix(nuxt): resolve modules from layers directories (#27338)

This commit is contained in:
Daniel Roe 2024-05-24 11:17:35 +01:00 committed by GitHub
parent 00ba04cb29
commit 2440007906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,6 +272,9 @@ async function initNuxt (nuxt: Nuxt) {
...nuxt.options._layers.filter(i => i.cwd.includes('node_modules')).map(i => i.cwd as string), ...nuxt.options._layers.filter(i => i.cwd.includes('node_modules')).map(i => i.cwd as string),
) )
// Ensure we can resolve dependencies within layers
nuxt.options.modulesDir.push(...nuxt.options._layers.map(l => resolve(l.cwd, 'node_modules')))
// Init user modules // Init user modules
await nuxt.callHook('modules:before') await nuxt.callHook('modules:before')
const modulesToInstall = [] const modulesToInstall = []