Skip to content

Commit 4df1e82

Browse files
committed
fix(nuxt): exempt webpack vfs from pkg lookup
1 parent 08dd1a3 commit 4df1e82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/nuxt/src/components/plugins/transform.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ export function TransformPlugin (nuxt: Nuxt, options: TransformPluginOptions) {
115115
if (!code.includes('#components')) { return }
116116

117117
// If package defines a "#components" import mapping, assume is used internally by the package.
118-
const pkg = isAbsolute(id) && id.includes('node_modules') ? await readPackage(id, { try: true }) : undefined
118+
const pkg = isAbsolute(id) && /node_modules[\\/](?!\.virtual)/.test(id)
119+
? await readPackage(id, { try: true })
120+
: undefined
119121
if (isObject(pkg) && isObject(pkg.imports) && Object.hasOwn(pkg.imports, '#components')) {
120122
return
121123
}

0 commit comments

Comments
 (0)