Repository navigation
rollup/plugin-replace generates sourcemap like nothing is replaced #1798
Replies: 1 comment
|
If you mean that the map still contains the original source text, that is expected: a source map maps positions in the generated code back to the input code. It is not a second copy of the transformed output. Seeing the original placeholder in I checked console.log(__LONG_PLACEHOLDER__, "tail");and: replace({
preventAssignment: true,
values: { __LONG_PLACEHOLDER__: '1' }
})
// output: { format: 'es', sourcemap: true }The generated JavaScript is The plugin implementation applies If instead the decoded positions are wrong, that is a different issue. A small input/config, the generated position, and its expected original position would help isolate it. This check covers a plain Rollup build, not the particular Vite/plugin chain in the linked question. |
Uh oh!
There was an error while loading. Please reload this page.
Hello
So i've noticed that plugin-replace generates source map as if nothing has been changed (though source itself does change)
I think this is due to magic-string producing same sourcemap as if for original files
This problem is around year old as I understand (https://stackoverflow.com/questions/77607028/rollup-transform-of-file-including-sourcemap-for-vite), so maybe someone can clarify if this is intended behaviour
Thanks
All reactions