diff --git a/packages/nuxt/src/components/transform.ts b/packages/nuxt/src/components/transform.ts index 579cf42e7b..6d1a45af39 100644 --- a/packages/nuxt/src/components/transform.ts +++ b/packages/nuxt/src/components/transform.ts @@ -47,7 +47,7 @@ export function createTransformPlugin (nuxt: Nuxt, getComponents: getComponentsT name: 'nuxt:components:imports', transformInclude (id) { id = normalize(id) - return id.startsWith('virtual:') || id.startsWith(nuxt.options.buildDir) || !isIgnored(id) + return id.startsWith('virtual:') || id.startsWith('\0virtual:') || id.startsWith(nuxt.options.buildDir) || !isIgnored(id) }, async transform (code, id) { // Virtual component wrapper diff --git a/packages/nuxt/src/core/plugins/resolve-deep-imports.ts b/packages/nuxt/src/core/plugins/resolve-deep-imports.ts index ba4aaf7bd4..032117178e 100644 --- a/packages/nuxt/src/core/plugins/resolve-deep-imports.ts +++ b/packages/nuxt/src/core/plugins/resolve-deep-imports.ts @@ -7,11 +7,12 @@ import type { Nuxt } from '@nuxt/schema' import { pkgDir } from '../../dirs' export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin { + const exclude: string[] = ['virtual:', '\0virtual:', '/__skip_vite'] return { name: 'nuxt:resolve-bare-imports', enforce: 'post', async resolveId (id, importer, options) { - if (!importer || isAbsolute(id) || !isAbsolute(importer) || id.startsWith('virtual:') || id.startsWith('/__skip_vite')) { + if (!importer || isAbsolute(id) || !isAbsolute(importer) || exclude.some(e => id.startsWith(e))) { return } id = normalize(id)