Skip to content

Commit db64f8a

Browse files
committed
fix: don't strip base from imports
1 parent 317b3b2 commit db64f8a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/vite/src/node/plugins/importAnalysis.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
323323
pos: number,
324324
forceSkipImportAnalysis: boolean = false,
325325
): Promise<[string, string | null]> => {
326-
url = stripBase(url, base)
327-
328326
let importerFile = importer
329327

330328
if (

packages/vite/src/node/plugins/worker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,14 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
451451
const workerType = workerFileMatch[1] as WorkerType
452452
let injectEnv = ''
453453

454-
const scriptPath = JSON.stringify(
455-
path.posix.join(config.base, ENV_PUBLIC_PATH),
456-
)
457-
458454
if (workerType === 'classic') {
455+
// base needs to be joined as the base is not injected to `importScripts` automatically
456+
const scriptPath = JSON.stringify(
457+
path.posix.join(config.base, ENV_PUBLIC_PATH),
458+
)
459459
injectEnv = `importScripts(${scriptPath})\n`
460460
} else if (workerType === 'module') {
461+
const scriptPath = JSON.stringify(ENV_PUBLIC_PATH)
461462
injectEnv = `import ${scriptPath}\n`
462463
} else if (workerType === 'ignore') {
463464
if (isBuild) {

0 commit comments

Comments
 (0)