Closed patrickhulce closed 7 years ago
Is there a specific issue in which you discovered this specific bug?
@TheLarkInn yep, while trying to write a webpack plugin that replaced a specific section of a bundle before uglifying using a ReplaceSource
, I noticed that enabling source maps would render the output unparseable.
This may not be what ReplaceSource
is intended for (and if I understood more about webpack internals I probably wouldn't even need to do it this way at all 😄), but this seemed like an undesirable property of a source either way. My current workaround is to narrow the scope of replacements to sections not containing a PrefixSource
.
Oh just wanted to double check!! No problem at all and we are 1000% for the contribution. Using webpack-sources is definitely the way to go for modifying sources. We've been trying to hunt down a bug related to source maps and didn't know if this was the motivation or not.
empty lines are not handled consistently which breaks
ReplaceSource
indices that might be based on a particular version of the source.Example Prefix:
foobar
Nodes:["console.log(1);\n", "\n", "console.log(2);\n"]
source() ->
foobar console.log(1);\n\nfoobar console.log(2);\n
sourceAndMap().source ->foobar console.log(1);\nfoobar \nfoobar console.log(2);\n