mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): exclude resolved vite virtual modules prefix (#22834)
This commit is contained in:
parent
adb6ec6742
commit
424dc8d7c0
@ -47,7 +47,7 @@ export function createTransformPlugin (nuxt: Nuxt, getComponents: getComponentsT
|
|||||||
name: 'nuxt:components:imports',
|
name: 'nuxt:components:imports',
|
||||||
transformInclude (id) {
|
transformInclude (id) {
|
||||||
id = normalize(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) {
|
async transform (code, id) {
|
||||||
// Virtual component wrapper
|
// Virtual component wrapper
|
||||||
|
@ -7,11 +7,12 @@ import type { Nuxt } from '@nuxt/schema'
|
|||||||
import { pkgDir } from '../../dirs'
|
import { pkgDir } from '../../dirs'
|
||||||
|
|
||||||
export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin {
|
export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin {
|
||||||
|
const exclude: string[] = ['virtual:', '\0virtual:', '/__skip_vite']
|
||||||
return {
|
return {
|
||||||
name: 'nuxt:resolve-bare-imports',
|
name: 'nuxt:resolve-bare-imports',
|
||||||
enforce: 'post',
|
enforce: 'post',
|
||||||
async resolveId (id, importer, options) {
|
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
|
return
|
||||||
}
|
}
|
||||||
id = normalize(id)
|
id = normalize(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user