New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pruning of sourcemap comments is too agressive #1104
Comments
I worked around this in https://gitlab.com/IvanSanchez/rollup-plugin-file-as-blob/commit/24d64f5e3e40c3d73e8c6e72100f1c85da5356f5?view=inline. Unless somebody else hits the problem, I guess this can be considered ultra-low priority. |
It looks like #1056. I got the same problem when worked on css modules |
This is fixed now – the regex for matching sourceMappingURL comments has a |
just for reference, fix proposed does not work for such case: var str = `
//# sourceMappingURL=...
`
console.log(str); I still get failled test in my plugin. |
Be advised this is an edge case.
I discovered this while working with my rollup-plugin-file-as-blob workflows. In order to reproduce the bug:
*.js
file with a//# sourceMappingURL=
comment at the endblob://
URL via rollup-plugin-file-as-blobMy plugin returns module code as follows:
Which, for a javascript file, might look like:
The code from 9164f80 will take that module code, run the regexp, not notice that the sourcemap comment is inside a string literal, then strip the closing
"
and the rest of the line, i.e.:That will obviously break all kinds of havoc in the parsers.
I think I can work around the bug in my plugin code, given that this is an edge case involving custom rollup plugins. Nonetheless I'd appreciate if rollup handling of sourcemap comments (9164f80) could be a bit less naïve.
The text was updated successfully, but these errors were encountered: