Minimal reproduction for a bug where vite-plugin-sveltekit-remote produces broken sourcemaps.
The plugin's transform hook modifies .remote.* files but doesn't return a map property, causing Vite to lose the sourcemap chain entirely. The resulting .map files have sources: [], empty sourcesContent, and semicolon-only mappings.
npm install
npm run build:bug
You'll see warnings like:
[plugin vite-plugin-sveltekit-remote] Sourcemap is likely to be incorrect: a]plugin (vite-plugin-sveltekit-remote)
failed to generate a sourcemap for src/lib/example.remote.ts with id src/lib/example.remote.ts.
Inspect the broken sourcemap:
cat .svelte-kit/output/server/chunks/example.remote.js.map
You'll see "sources":[], "sourcesContent":[], and only semicolons in "mappings".
npm run build:fix
No warnings. Inspect the fixed sourcemap:
cat .svelte-kit/output/server/chunks/example.remote.js.map
Now has proper sources, sourcesContent, and real VLQ mappings.
See patches/@sveltejs+kit+2.53.4.patch:
MagicString (already a dependency) instead of bare string concatenation, returns { code, map } with a proper sourcemapmap: { mappings: '' } to signal an intentional full replacement (no original code preserved)src/lib/example.remote.ts — Remote function file (the file that triggers the bug)src/routes/+page.svelte — Page that imports the remote functionsvelte.config.js — Enables experimental.remoteFunctionsvite.config.js — Enables build.sourcemap (required to generate .map files)patches/@sveltejs+kit+2.53.4.patch — The fix