Skip to content

Commit a0f00ee

Browse files
authored
refactor(worker): use existing isBuild flag (#2853)
1 parent f17e19a commit a0f00ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
4141
}
4242

4343
let url: string
44-
if (config.command === 'serve') {
45-
url = await fileToUrl(cleanUrl(id), config, this)
46-
url = injectQuery(url, WorkerFileId)
47-
} else {
44+
if (isBuild) {
4845
if (query.inline != null) {
4946
// bundle the file as entry to support imports and inline as base64
5047
// data url
@@ -71,6 +68,9 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
7168
id: cleanUrl(id)
7269
})}__`
7370
}
71+
} else {
72+
url = await fileToUrl(cleanUrl(id), config, this)
73+
url = injectQuery(url, WorkerFileId)
7474
}
7575

7676
return `export default function WorkerWrapper() {

0 commit comments

Comments
 (0)