fix(vite): respect ctx.nuxt.options.modulesDir for resolving externals with vite-node (#7612)

This commit is contained in:
pooya parsa 2022-09-17 00:29:41 +02:00 committed by GitHub
parent 8621c86055
commit abd0feb368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,7 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set<strin
node.shouldExternalize = async (id: string) => { node.shouldExternalize = async (id: string) => {
const result = await isExternal(id) const result = await isExternal(id)
if (result?.external) { if (result?.external) {
return resolveModule(result.id, { url: ctx.nuxt.options.rootDir }) return resolveModule(result.id, { url: ctx.nuxt.options.modulesDir })
} }
return false return false
} }