mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(vite): ignore virtual imports that aren't in vfs (#4822)
Co-authored-by: Dario Merz <dario.merz@deptagency.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
5816fee892
commit
31c67ad9b4
@ -1,7 +1,7 @@
|
||||
import { dirname, isAbsolute, join, resolve } from 'pathe'
|
||||
import type { Plugin } from 'rollup'
|
||||
|
||||
const PREFIX = 'virtual:'
|
||||
const PREFIX = 'virtual:nuxt:'
|
||||
|
||||
export default function virtual (vfs: Record<string, string>): Plugin {
|
||||
const extensions = ['', '.ts', '.vue', '.mjs', '.cjs', '.js', '.json']
|
||||
@ -37,9 +37,11 @@ export default function virtual (vfs: Record<string, string>): Plugin {
|
||||
load (id) {
|
||||
if (!id.startsWith(PREFIX)) { return null }
|
||||
const idNoPrefix = id.slice(PREFIX.length)
|
||||
return {
|
||||
code: vfs[idNoPrefix],
|
||||
map: null
|
||||
if (idNoPrefix in vfs) {
|
||||
return {
|
||||
code: vfs[idNoPrefix],
|
||||
map: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user