diff --git a/src/compiler/bundle/worker-plugin.ts b/src/compiler/bundle/worker-plugin.ts index 6c455eb13b5..7b2a42fc4e2 100644 --- a/src/compiler/bundle/worker-plugin.ts +++ b/src/compiler/bundle/worker-plugin.ts @@ -19,7 +19,10 @@ export const workerPlugin = ( name: 'workerPlugin', transform(_, id) { if (id.endsWith('?worker') || id.endsWith('?worker-inline')) { - return getMockedWorkerMain(); + return { + code: getMockedWorkerMain(), + map: { mappings: '' }, + }; } return null; }, @@ -77,6 +80,7 @@ export const workerPlugin = ( dependencies.forEach((id) => this.addWatchFile(id)); return { code: getWorkerMain(referenceId, workerName, workerMsgId), + map: { mappings: '' }, moduleSideEffects: false, }; } else if (id.endsWith('?worker-inline')) { @@ -98,6 +102,7 @@ export const workerPlugin = ( dependencies.forEach((id) => this.addWatchFile(id)); return { code: getInlineWorker(referenceId, workerName, workerMsgId), + map: { mappings: '' }, moduleSideEffects: false, }; } @@ -110,11 +115,13 @@ export const workerPlugin = ( if (inlineWorkers) { return { code: getInlineWorkerProxy(workerEntryPath, worker.workerMsgId, worker.exports), + map: { mappings: '' }, moduleSideEffects: false, }; } else { return { code: getWorkerProxy(workerEntryPath, worker.exports), + map: { mappings: '' }, moduleSideEffects: false, }; } @@ -405,7 +412,7 @@ const getWorkerMain = (referenceId: string, workerName: string, workerMsgId: str import { createWorker } from '${WORKER_HELPER_ID}'; export const workerName = '${workerName}'; export const workerMsgId = '${workerMsgId}'; -export const workerPath = /*@__PURE__*/import.meta.ROLLUP_FILE_URL_${referenceId}; +export const workerPath = import.meta.ROLLUP_FILE_URL_${referenceId}; export const worker = /*@__PURE__*/createWorker(workerPath, workerName, workerMsgId); `; }; @@ -415,7 +422,7 @@ const getInlineWorker = (referenceId: string, workerName: string, workerMsgId: s import { createWorker } from '${WORKER_HELPER_ID}'; export const workerName = '${workerName}'; export const workerMsgId = '${workerMsgId}'; -export const workerPath = /*@__PURE__*/import.meta.ROLLUP_FILE_URL_${referenceId}; +export const workerPath = import.meta.ROLLUP_FILE_URL_${referenceId}; export let worker; try { // first try directly starting the worker with the URL