Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add \0 to virtual files id #11261

Merged
merged 3 commits into from Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Comment on lines 16 to +17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
},
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