Skip to content

Commit 8cab72c

Browse files
authored
fix(worker): match worker import meta more quickly (#336)
1 parent b19b90a commit 8cab72c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async function getWorkerType(
181181
}
182182

183183
const workerImportMetaUrlRE =
184-
/new\s+(?:Worker|SharedWorker).+new\s+URL.+import\.meta\.url/s
184+
/new\s+(?:Worker|SharedWorker)\s*\(\s*new\s+URL.+?import\.meta\.url/s
185185

186186
export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
187187
const isBuild = config.command === 'build'

0 commit comments

Comments
 (0)