Skip to content

Commit

Permalink
fix: add source map to Web Workers (fix #14216) (#14217)
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan authored and bluwy committed Oct 3, 2023
1 parent c4758d1 commit df6f32f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vite/src/node/plugins/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,15 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
injectEnv = module?.transformResult?.code || ''
}
}
return {
code: injectEnv + raw,
if (injectEnv) {
const s = new MagicString(raw)
s.prepend(injectEnv)
return {
code: s.toString(),
map: s.generateMap({ hires: 'boundary' }),
}
}
return
}
if (
query == null ||
Expand Down

0 comments on commit df6f32f

Please # to comment.