compilation.assets[fileName] does not only contain source info but also contains other info like source-maps, compilation.assets[fileName] = new ConcatSource(result); would cause source-maps missing problem. I recommend another plugin webpack-string-replacer, I tried works well.