underfin / vite-plugin-vue2

Vue2 plugin for Vite
620 stars 83 forks source link

fix: missing sourcemap fields after compiling ts in dev #158

Closed dreamerblue closed 2 years ago

dreamerblue commented 2 years ago

If other Vite plugin transformed vue code before vite-plugin-vue2, the code passed to transform() will be the modified code.

But if the code source is TypeScript, the esbuild transform result will miss some sourcemap fields like sourcesContent. it will cause rollup try to read source content from file system (its different from modified code) when generating sourcemap, so the final sourcemap cannot be mapped to current source.

This PR fixed it by adding missing fields from previous map.