diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index 9157a97311fb03..7ca8deb1a7b311 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -262,6 +262,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { }, load: { + filter: { id: workerOrSharedWorkerRE }, async handler(id) { const workerMatch = workerOrSharedWorkerRE.exec(id) if (!workerMatch) return @@ -364,6 +365,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { }, transform: { + filter: { id: workerFileRE }, async handler(raw, id) { const workerFileMatch = workerFileRE.exec(id) if (workerFileMatch) {