From 7c51de428a6aa30d77048bb33791f9094113cc95 Mon Sep 17 00:00:00 2001 From: Thuan Vo Date: Wed, 31 May 2023 05:26:53 -0400 Subject: [PATCH] chore(webpack): disable devtool for production builds --- package.json | 2 +- webpack.prod.js | 12 ++++++++++-- yarn.lock | 52 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ed456af803..dbdc863d9f 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "rxjs": "^7.8.0", "style-loader": "^3.3.1", "svg-url-loader": "^8.0.0", - "terser-webpack-plugin": "^5.3.3", + "terser-webpack-plugin": "^5.3.9", "ts-jest": "^27.0.5", "ts-loader": "^9.4.2", "tsconfig-paths-webpack-plugin": "^4.0.0", diff --git a/webpack.prod.js b/webpack.prod.js index d67d561dd3..46d9006611 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -8,15 +8,23 @@ const { EnvironmentPlugin } = require('webpack'); module.exports = merge(common('production'), { mode: 'production', - devtool: 'eval-source-map', + devtool: false, cache: { type: 'filesystem', compression: 'gzip', cacheDirectory: path.resolve(__dirname, '.build_cache'), }, optimization: { + minimize: true, minimizer: [ - new TerserJSPlugin({}), + new TerserJSPlugin({ + terserOptions: { + format: { + comments: false, + }, + }, + extractComments: false, + }), new CssMinimizerPlugin({ minimizerOptions: { preset: ['default', { mergeLonghand: false }] diff --git a/yarn.lock b/yarn.lock index e95eec8b48..a5fa865372 100644 --- a/yarn.lock +++ b/yarn.lock @@ -957,6 +957,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.17": + version: 0.3.18 + resolution: "@jridgewell/trace-mapping@npm:0.3.18" + dependencies: + "@jridgewell/resolve-uri": 3.1.0 + "@jridgewell/sourcemap-codec": 1.4.14 + checksum: 0572669f855260808c16fe8f78f5f1b4356463b11d3f2c7c0b5580c8ba1cbf4ae53efe9f627595830856e57dbac2325ac17eb0c3dd0ec42102e6f227cc289c02 + languageName: node + linkType: hard + "@leichtgewicht/ip-codec@npm:^2.0.1": version: 2.0.4 resolution: "@leichtgewicht/ip-codec@npm:2.0.4" @@ -3991,7 +4001,7 @@ __metadata: showdown: ^2.1.0 style-loader: ^3.3.1 svg-url-loader: ^8.0.0 - terser-webpack-plugin: ^5.3.3 + terser-webpack-plugin: ^5.3.9 ts-jest: ^27.0.5 ts-loader: ^9.4.2 tsconfig-paths-webpack-plugin: ^4.0.0 @@ -11844,7 +11854,7 @@ __metadata: languageName: node linkType: hard -"serialize-javascript@npm:^6.0.0": +"serialize-javascript@npm:^6.0.0, serialize-javascript@npm:^6.0.1": version: 6.0.1 resolution: "serialize-javascript@npm:6.0.1" dependencies: @@ -12615,7 +12625,7 @@ __metadata: languageName: node linkType: hard -"terser-webpack-plugin@npm:^5.1.3, terser-webpack-plugin@npm:^5.3.3": +"terser-webpack-plugin@npm:^5.1.3": version: 5.3.6 resolution: "terser-webpack-plugin@npm:5.3.6" dependencies: @@ -12637,6 +12647,28 @@ __metadata: languageName: node linkType: hard +"terser-webpack-plugin@npm:^5.3.9": + version: 5.3.9 + resolution: "terser-webpack-plugin@npm:5.3.9" + dependencies: + "@jridgewell/trace-mapping": ^0.3.17 + jest-worker: ^27.4.5 + schema-utils: ^3.1.1 + serialize-javascript: ^6.0.1 + terser: ^5.16.8 + peerDependencies: + webpack: ^5.1.0 + peerDependenciesMeta: + "@swc/core": + optional: true + esbuild: + optional: true + uglify-js: + optional: true + checksum: 41705713d6f9cb83287936b21e27c658891c78c4392159f5148b5623f0e8c48559869779619b058382a4c9758e7820ea034695e57dc7c474b4962b79f553bc5f + languageName: node + linkType: hard + "terser@npm:^5.10.0, terser@npm:^5.14.1": version: 5.16.3 resolution: "terser@npm:5.16.3" @@ -12651,6 +12683,20 @@ __metadata: languageName: node linkType: hard +"terser@npm:^5.16.8": + version: 5.17.6 + resolution: "terser@npm:5.17.6" + dependencies: + "@jridgewell/source-map": ^0.3.2 + acorn: ^8.5.0 + commander: ^2.20.0 + source-map-support: ~0.5.20 + bin: + terser: bin/terser + checksum: 9c0ab0261a99a61c5f53d05d4ecc7f68c552bae6af481464fdd596bc9d7e89ce8e21b1833cb3ce06ad5f658e2b226081d543e4fe6e324b2cdf03ee8b7eeec01a + languageName: node + linkType: hard + "test-exclude@npm:^6.0.0": version: 6.0.0 resolution: "test-exclude@npm:6.0.0"