diff --git a/build/webpack/webpack.config.base.js b/build/webpack/webpack.config.base.js index 8d2ff9929b4a..b2393462afc7 100644 --- a/build/webpack/webpack.config.base.js +++ b/build/webpack/webpack.config.base.js @@ -156,7 +156,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in setImmediate: false }, optimization: { - minimize: true, + minimize: env.mode === 'production', minimizer: [ new TerserPlugin({ terserOptions: { diff --git a/build/webpack/webpack.gni b/build/webpack/webpack.gni index f2bddbd5ae2b..2157cceabe32 100644 --- a/build/webpack/webpack.gni +++ b/build/webpack/webpack.gni @@ -22,6 +22,11 @@ template("webpack_build") { "//electron/typings/internal-electron.d.ts", ] + invoker.inputs + mode = "development" + if (is_official_build) { + mode = "production" + } + args = [ "--config", rebase_path(invoker.config_file), @@ -29,6 +34,7 @@ template("webpack_build") { "--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")), "--env.buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"), + "--env.mode=" + mode, ] deps += [ "buildflags" ]