We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
config.base
1 parent bbd1ffd commit 8e6cee8Copy full SHA for 8e6cee8
packages/vite/src/node/plugins/worker.ts
@@ -255,10 +255,14 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
255
const workerType = query['type']! as WorkerType
256
let injectEnv = ''
257
258
+ const scriptPath = JSON.stringify(
259
+ path.posix.join(config.base, ENV_PUBLIC_PATH),
260
+ )
261
+
262
if (workerType === 'classic') {
- injectEnv = `importScripts('${ENV_PUBLIC_PATH}')\n`
263
+ injectEnv = `importScripts(${scriptPath})\n`
264
} else if (workerType === 'module') {
- injectEnv = `import '${ENV_PUBLIC_PATH}'\n`
265
+ injectEnv = `import ${scriptPath}\n`
266
} else if (workerType === 'ignore') {
267
if (isBuild) {
268
injectEnv = ''
0 commit comments