Skip to content

Commit

Permalink
chore: add \0 to virtual files id (vitejs#11261)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored and futurGH committed Feb 26, 2023
1 parent b69266a commit b333ac9
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
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
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
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 b333ac9

Please sign in to comment.