Closed
Description
Describe the bug
When using new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' })
to load a Web Worker, the worker script has incorrect source map.
Reproduction
https://stackblitz.com/edit/vitejs-vite-f2cvz7?file=counter.js,worker.ts&terminal=dev
Steps to reproduce
- Open DevTools
- Reload the preview page
- DevTools will automatically show source for
worker.ts
- Try to set a breakpoint at line 5 (
console.log('small');
) - The breakpoint is at line 6
System Info
System:
OS: Windows 10 10.0.25936
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 11.50 GB / 31.91 GB
Binaries:
Node: 18.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.6.5 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Chromium (116.0.1938.62)
Internet Explorer: 11.0.25936.1000
npmPackages:
vite: ^4.4.6 => 4.4.6
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.