Rich-Harris / magic-string

Manipulate strings like a wizard
MIT License
2.37k stars 113 forks source link

Rollup source transform + sourcemap returns original sourcemap #290

Open nikitaosyak opened 1 month ago

nikitaosyak commented 1 month ago

Hello!

I wanted to make simple source transform, as intended by your library. I do everything like documentation says here:

https://rollupjs.org/plugin-development/#source-code-transformations

using this example, rollup produces sourcemap as it was in the original file (file transform does work though)

some guy on the internet have exactly the same problem (at least had it last year, I guess it's not solved) here: https://stackoverflow.com/questions/77607028/rollup-transform-of-file-including-sourcemap-for-vite

I'll also try and reach people from rollup, but maybe I can get my solution here

thanks!

nikitaosyak commented 1 month ago

I also noticed that rollup plugin replace behaves like this also, since it's using magic-string library :)

https://github.com/rollup/plugins/tree/master/packages/replace