mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): exclude non-cwd auto-imports and don't process all files (#5421)
This commit is contained in:
parent
67d804400b
commit
59da4c6dd4
@ -15,13 +15,8 @@ export const TransformPlugin = createUnplugin(({ ctx, options, sourcemap }: {ctx
|
||||
const exclude = options.transform?.exclude || [/[\\/]node_modules[\\/]/]
|
||||
const include = options.transform?.include || []
|
||||
|
||||
// Custom includes
|
||||
if (include.some(pattern => id.match(pattern))) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Exclude node_modules by default
|
||||
if (exclude.some(pattern => id.match(pattern))) {
|
||||
// Custom includes - exclude node_modules by default
|
||||
if (exclude.some(pattern => id.match(pattern)) && !include.some(pattern => id.match(pattern))) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
|
||||
options._modules.push([autoImportsModule, {
|
||||
transform: {
|
||||
include: options._layers
|
||||
.filter(i => i.cwd)
|
||||
.filter(i => i.cwd && i.cwd.includes('node_modules'))
|
||||
.map(i => new RegExp(`(^|\\/)${escapeRE(i.cwd.split('node_modules/').pop())}(\\/|$)(?!node_modules\\/)`))
|
||||
}
|
||||
}])
|
||||
|
Loading…
Reference in New Issue
Block a user