Skip to content

Commit

Permalink
chore: add \0 to virtual files id (#11261)
Browse files Browse the repository at this point in the history
fixes #10096
  • Loading branch information
sapphi-red authored Dec 9, 2022
1 parent 495c0be commit 02cdfa9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/dynamicImportVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '../utils'
import { toAbsoluteGlob } from './importMetaGlob'

export const dynamicImportHelperId = '/@vite/dynamic-import-helper'
export const dynamicImportHelperId = '\0vite/dynamic-import-helper'

interface DynamicImportRequest {
as?: keyof KnownAsTypeMap
Expand Down
5 changes: 3 additions & 2 deletions packages/vite/src/node/plugins/modulePreloadPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Plugin } from '../plugin'
import { isModernFlag } from './importAnalysisBuild'

export const modulePreloadPolyfillId = 'vite/modulepreload-polyfill'
const resolvedModulePreloadPolyfillId = '\0' + modulePreloadPolyfillId

export function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin {
// `isModernFlag` is only available during build since it is resolved by `vite:build-import-analysis`
Expand All @@ -13,11 +14,11 @@ export function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin {
name: 'vite:modulepreload-polyfill',
resolveId(id) {
if (id === modulePreloadPolyfillId) {
return id
return resolvedModulePreloadPolyfillId
}
},
load(id) {
if (id === modulePreloadPolyfillId) {
if (id === resolvedModulePreloadPolyfillId) {
if (skip) {
return ''
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ResolvedConfig } from '../config'
import type { Plugin } from '../plugin'
import { fileToUrl } from './asset'

const wasmHelperId = '/__vite-wasm-helper'
const wasmHelperId = '\0vite/wasm-helper'

const wasmHelper = async (opts = {}, url: string) => {
let result
Expand Down

0 comments on commit 02cdfa9

Please sign in to comment.