Browse Source

build: minify internal JS code (#24273)

* chore: minify internal JS code

* chore: upgrade webpack

Co-authored-by: Samuel Attard <[email protected]>
trop[bot] 4 years ago
parent
commit
1e38fb1a8d
3 changed files with 374 additions and 297 deletions
  1. 13 1
      build/webpack/webpack.config.base.js
  2. 3 3
      package.json
  3. 358 293
      yarn.lock

+ 13 - 1
build/webpack/webpack.config.base.js

@@ -1,6 +1,7 @@
 const fs = require('fs')
 const path = require('path')
 const webpack = require('webpack')
+const TerserPlugin = require('terser-webpack-plugin');
 
 const electronRoot = path.resolve(__dirname, '../..')
 
@@ -94,7 +95,7 @@ module.exports = ({
 
   return ({
     mode: 'development',
-    devtool: 'inline-source-map',
+    devtool: false,
     entry,
     target: alwaysHasNode ? 'node' : 'web',
     output: {
@@ -134,6 +135,17 @@ module.exports = ({
       // one of our renderer bundles should import it from the 'timers' package
       setImmediate: false,
     },
+    optimization: {
+      minimize: true,
+      minimizer: [
+        new TerserPlugin({
+          terserOptions: {
+            keep_classnames: true,
+            keep_fnames: true,
+          },
+        }),
+      ],
+    },
     plugins: [
       new AccessDependenciesPlugin(),
       ...(targetDeletesNodeGlobals ? [

+ 3 - 3
package.json

@@ -62,8 +62,8 @@
     "ts-loader": "^6.0.2",
     "ts-node": "^6.0.3",
     "typescript": "^3.5.2",
-    "webpack": "^4.32.2",
-    "webpack-cli": "^3.3.2"
+    "webpack": "^4.43.0",
+    "webpack-cli": "^3.3.12"
   },
   "private": true,
   "scripts": {
@@ -144,4 +144,4 @@
   "dependencies": {
     "@types/temp": "^0.8.34"
   }
-}
+}

File diff suppressed because it is too large
+ 358 - 293
yarn.lock


Some files were not shown because too many files changed in this diff