Skip to content

Commit

Permalink
fix(plugin-legacy): fix legacy plugin not working in worker context
Browse files Browse the repository at this point in the history
  • Loading branch information
sapenlei committed Dec 26, 2024
1 parent f7b1964 commit 3433779
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,10 @@ function prependModenChunkLegacyGuardPlugin(): Plugin {
}

function isLegacyChunk(chunk: RenderedChunk, options: NormalizedOutputOptions) {
return options.format === 'system' && chunk.fileName.includes('-legacy')
return (
(options.format === 'system' && chunk.fileName.includes('-legacy')) ||
(options.format === 'iife' && chunk.name === 'worker')
)
}

function isLegacyBundle(
Expand Down

0 comments on commit 3433779

Please sign in to comment.