lifthrasiir / roadroller

Roadroller: Flattens Your JavaScript Demo
https://lifthrasiir.github.io/roadroller/
Other
328 stars 12 forks source link

Source map support #34

Open lifthrasiir opened 2 years ago

lifthrasiir commented 2 years ago

It turns out that we can put the source map comment into evaled code and devtools do recognize it. This should not present in the final build, so I think the resulting code should be made obvious that the source map is in use, like this:

eval(Function(/* compressed data here */)(...)+'\n//# sourceMappingUrl=foo.js.map')

We would have to preserve the existing sourceMappingUrl comment and update it (and also sourceURL) if the JS preprocessing is in use.