SSR transform sets map.sources
paths incorrectly
#18144
Labels
feat: sourcemap
Sourcemap support
feat: ssr
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
When Vite SSR transforms file that has source map with multiple sources, it sets the
map.sources
paths incorrectly. This causes issues in Vitest: vitest-dev/vitest#6526With source map like:
... Vite incorrectly prepends the both source as following.
There is no
../node_modules/.pnpm/base32-decode@1.0.0/node_modules/node_modules/
or../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/pkg-a-entrypoint.js
on filesystem.The bug happens here:
vite/packages/vite/src/node/utils.ts
Lines 864 to 874 in b529b6f
Reproduction
https://stackblitz.com/c/edit/vite-ssr-map-sources?file=pkg-b%2Fserver.mjs
Steps to reproduce
Isolated reproduction with "@ampproject/remapping" without Vite
System Info
Used Package Manager
pnpm
Logs
Validations
The text was updated successfully, but these errors were encountered: