Skip to content

Commit

Permalink
fix: add source map to Web Workers
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Aug 28, 2023
1 parent 91a18c2 commit c07360d
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 c07360d

Please sign in to comment.