Breaks when module ID includes query parameters
segevfiner opened this issue · comments
Try https://github.com/segevfiner/vite-worker-sourcemaps-bug, the source map for worker.ts?worker
is null
which means source stepping doesn't work. The source map for test.js
is bugged completely and in addition has null
in the sources
, which is not allowed, and causes the browser to try to present the file null
as the source. This is encountered in Vite via using magic-string
inside @rollup/plugin-replace
for a dynamic replacement (Which is why it doesn't use Vite builtin define
). Likely caused by the query parameter used for workers, and the dynamic ?t=${timestamp}
cache busting query parameter added by Vite.
There are often also warning of the form:
Sourcemap for "/Users/segevfiner/junk/vite-worker-sourcemaps-bug/src/worker.ts" points to missing source files
cc @YossiSaadi
I tried to debug this further and it seems it might be an issue in Vite own sourcemaps plugin that doesn't handle it's own ids with query parameters when there are plugins that output some kinds of sourcemaps. I'll reopen there.