Skip to content

Commit 3c93fde

Browse files
authored
fix(worker): apply build.target to worker bundle (#22404)
1 parent 18f0f90 commit 3c93fde

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ async function bundleWorkerEntry(
189189
await workerEnvironment.init()
190190

191191
const chunkMetadataMap = new ChunkMetadataMap()
192+
const workerBuildTarget = workerEnvironment.config.build.target
192193
const bundle = await rolldown({
193194
...rollupOptions,
194195
input,
@@ -198,6 +199,10 @@ async function bundleWorkerEntry(
198199
onLog(level, log) {
199200
onRollupLog(level, log, workerEnvironment)
200201
},
202+
transform: {
203+
target: workerBuildTarget === false ? undefined : workerBuildTarget,
204+
...rollupOptions.transform,
205+
},
201206
// TODO: remove this and enable rolldown's CSS support later
202207
moduleTypes: {
203208
'.css': 'js',

0 commit comments

Comments
 (0)