diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index e80abfad4a1fd2..d441926b834d64 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -168,11 +168,13 @@ export function webWorkerPostPlugin(): Plugin { resolveImportMeta(property, { chunkId, format }) { // document is undefined in the worker, so we need to avoid it in iife if (format === 'iife') { + // Transpiling import.meta if (!property) { return `{ url: self.location.href }` } + // Transpiling import.meta.url if (property === 'url') { return 'self.location.href' }