From 01658295247962f6497c29ec5370179037439056 Mon Sep 17 00:00:00 2001 From: GrzegorzZajac000 Date: Fri, 8 Mar 2024 10:02:04 +0100 Subject: [PATCH] #1513 Production optimizations --- .babelrc | 4 +++- webpack/production/background.prod.config.js | 15 ++++++++++----- webpack/production/contentScript.prod.config.js | 13 ++++++++++--- webpack/production/installPage.prod.config.js | 13 ++++++++++--- webpack/production/optionsPage.prod.config.js | 13 ++++++++++--- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/.babelrc b/.babelrc index aeb3358..b30bf42 100644 --- a/.babelrc +++ b/.babelrc @@ -5,7 +5,9 @@ }, "modules": "commonjs" }], ["minify", { - "builtIns": false + "builtIns": false, + "keepFnName": true, + "removeDebugger": true }]], "env": { "production": { diff --git a/webpack/production/background.prod.config.js b/webpack/production/background.prod.config.js index 9cc49b9..33f7238 100644 --- a/webpack/production/background.prod.config.js +++ b/webpack/production/background.prod.config.js @@ -25,7 +25,6 @@ const webpack = require('webpack'); const path = require('path'); const ESLintPlugin = require('eslint-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); -const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const backgroundProdConfig = { name: 'background', @@ -64,14 +63,20 @@ const backgroundProdConfig = { constants: 'constants' }, optimization: { - moduleIds: 'named', + chunkIds: 'size', + moduleIds: 'size', + concatenateModules: true, + mangleExports: 'size', removeAvailableModules: true, removeEmptyChunks: true, mergeDuplicateChunks: true, + minimize: true, minimizer: [ - new TerserPlugin(), - new CssMinimizerPlugin() - ] + new TerserPlugin({ + parallel: true + }) + ], + nodeEnv: 'production' }, resolve: { modules: ['node_modules'] diff --git a/webpack/production/contentScript.prod.config.js b/webpack/production/contentScript.prod.config.js index 4d0123b..2807cbf 100644 --- a/webpack/production/contentScript.prod.config.js +++ b/webpack/production/contentScript.prod.config.js @@ -72,14 +72,21 @@ const contentScriptProdConfig = { ] }, optimization: { - moduleIds: 'named', + chunkIds: 'size', + moduleIds: 'size', + concatenateModules: true, + mangleExports: 'size', removeAvailableModules: true, removeEmptyChunks: true, mergeDuplicateChunks: true, + minimize: true, minimizer: [ - new TerserPlugin(), + new TerserPlugin({ + parallel: true + }), new CssMinimizerPlugin() - ] + ], + nodeEnv: 'production' }, plugins: [ new ESLintPlugin({ diff --git a/webpack/production/installPage.prod.config.js b/webpack/production/installPage.prod.config.js index 7d2ccfa..1c29276 100644 --- a/webpack/production/installPage.prod.config.js +++ b/webpack/production/installPage.prod.config.js @@ -97,14 +97,21 @@ const installPageProdConfig = { constants: 'constants' }, optimization: { - moduleIds: 'named', + chunkIds: 'size', + moduleIds: 'size', + concatenateModules: true, + mangleExports: 'size', removeAvailableModules: true, removeEmptyChunks: true, mergeDuplicateChunks: true, + minimize: true, minimizer: [ - new TerserPlugin(), + new TerserPlugin({ + parallel: true + }), new CssMinimizerPlugin() - ] + ], + nodeEnv: 'production' }, resolve: { modules: ['node_modules'] diff --git a/webpack/production/optionsPage.prod.config.js b/webpack/production/optionsPage.prod.config.js index 98f6506..d4f8c07 100644 --- a/webpack/production/optionsPage.prod.config.js +++ b/webpack/production/optionsPage.prod.config.js @@ -108,14 +108,21 @@ const optionsPageProdConfig = { constants: 'constants' }, optimization: { - moduleIds: 'named', + chunkIds: 'size', + moduleIds: 'size', + concatenateModules: true, + mangleExports: 'size', removeAvailableModules: true, removeEmptyChunks: true, mergeDuplicateChunks: true, + minimize: true, minimizer: [ - new TerserPlugin(), + new TerserPlugin({ + parallel: true + }), new CssMinimizerPlugin() - ] + ], + nodeEnv: 'production' }, resolve: { modules: ['node_modules']