Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Workers in TypeScript have incorrect source map #14216

Closed
7 tasks done
yume-chan opened this issue Aug 28, 2023 · 1 comment · Fixed by #14217
Closed
7 tasks done

Web Workers in TypeScript have incorrect source map #14216

yume-chan opened this issue Aug 28, 2023 · 1 comment · Fixed by #14217
Labels
feat: web workers p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@yume-chan
Copy link
Contributor

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

  1. Open DevTools
  2. Reload the preview page
  3. DevTools will automatically show source for worker.ts
  4. Try to set a breakpoint at line 5 (console.log('small');)
  5. 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

@stackblitz
Copy link

stackblitz bot commented Aug 28, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: web workers p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants