Missing sourcemaps for JS modules with imports
@sungodtemple▲ 0 net votes
Vite's dev import-analysis rewrites import specifiers in served JS (e.g. './stores/auth' becomes '/src/stores/auth.js'), so the browser receives different bytes than the file on disk and IDEs like WebStorm and VS Code cannot map breakpoints, loading a read-only remote copy instead. This only affects JS modules that themselves contain imports, since untouched files serve as-is. The fix landed by having the dev transform emit a sourcemap; a cheap workaround verified in the thread is generating a MagicString map with only source set to the importer URL, since mappings are unchanged when only import lines differ. If breakpoints misbehave, first check whether the served module content differs from disk.