Only mangle extension private properties in production builds (#171684)

This speeds up watch-web
This commit is contained in:
Matt Bierner 2023-01-18 15:16:25 -08:00 committed by GitHub
parent d0f0a5659f
commit d0176b8a87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,11 @@ function getMangledFileContents(projectPath) {
* @type {webpack.LoaderDefinitionFunction}
*/
module.exports = async function (source, sourceMap, meta) {
if (this.mode !== 'production') {
// Only enable mangling in production builds
return source;
}
if (source !== fs.readFileSync(this.resourcePath).toString()) {
// File content has changed by previous webpack steps.
// Skip mangling.