Open wxfred opened 3 years ago
I simply change a little bit of dist/plugin/index.js
, it works, but I'm not sure if there's a potential problem.
Looking forward to your update!
//compilation.chunks.forEach(chunk => {
//chunk.files.forEach((fileName) => {
for (let fileName in compilation.assets) { // replace 2 lines above
if (this.options.sourceMap && fileName.toLowerCase().endsWith('.map')) {
let srcName = fileName.toLowerCase().substr(0, fileName.length - 4);
if (!this.shouldExclude(srcName)) {
const transferredSourceMap = transferSourceMap({
fromSourceMap: sourcemapOutput[srcName],
toSourceMap: compilation.assets[fileName].source()
});
const finalSourcemap = JSON.parse(transferredSourceMap);
finalSourcemap['sourcesContent'] = JSON.parse(compilation.assets[fileName].source())['sourcesContent'];
compilation.assets[fileName] = new webpack_sources_1.RawSource(JSON.stringify(finalSourcemap));
}
return;
}
if (!fileName.toLowerCase().endsWith('.js') || this.shouldExclude(fileName)) {
return;
}
const asset = compilation.assets[fileName];
const {
inputSource,
inputSourceMap
} = this.extractSourceAndSourceMap(asset);
const {
obfuscatedSource,
obfuscationSourceMap
} = this.obfuscate(inputSource, fileName, identifiersPrefixCounter);
if (this.options.sourceMap && inputSourceMap) {
sourcemapOutput[fileName] = obfuscationSourceMap;
}
compilation.assets[fileName] = new webpack_sources_1.RawSource(obfuscatedSource);
identifiersPrefixCounter++;
} // replace 2 lines below
//});
//});
I will try it in the upcoming weeks.
Any update on this? :eyes:
Is it possible to include web worker files, after compilation, they are not in
compilation.chunks
.