Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(vite): ignore virtual imports that aren't in vfs #4822

Merged
merged 6 commits into from
May 6, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/vite/src/plugins/virtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
danielroe marked this conversation as resolved.
Show resolved Hide resolved
return {
code: vfs[idNoPrefix],
map: null
}
}
}
}
Expand Down