sveltejs / vite-plugin-svelte

Svelte plugin for http://vitejs.dev/
MIT License
864 stars 105 forks source link

fix(vitePreprocess): remove dangling pure annotations #609

Closed dominikg closed 1 year ago

dominikg commented 1 year ago

see https://github.com/sveltejs/kit/issues/9492

This is a workaround, the actual cause is the svelte compiler moving inline pure annotation comments to the end of a line, so that the subsequent bundling step associates them with a different node, possibly causing code to be removed that should have been preserved or otherwise altering the build output.

/* @__PURE__ */ comments that are at the end of a line are being replaced with the same amount of spaces so that character count/sourcemaps remain unaffected.