From 98f3061c54be48ebc98c218e9d0a88c70c878be1 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 10 Jul 2024 14:01:45 -0500 Subject: [PATCH] Update serviceworker.config.js webpack Motivation: switch to new weback plugins & bring in line with master --- build/config/serviceworker.config.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/build/config/serviceworker.config.js b/build/config/serviceworker.config.js index 898f966c9..c52064f75 100644 --- a/build/config/serviceworker.config.js +++ b/build/config/serviceworker.config.js @@ -1,8 +1,7 @@ const webpack = require('webpack'); const path = require('path'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -const { CheckerPlugin } = require('awesome-typescript-loader'); +const TerserPlugin = require('terser-webpack-plugin'); const env = process.env.ENV || "production"; const buildOrigin = process.env.BUILD_ORIGIN || "localhost"; @@ -15,10 +14,8 @@ const noDevPort = process.env.NO_DEV_PORT; const tests = process.env.TESTS; const sdkVersion = process.env.npm_package_config_sdkVersion; -async function getWebpackPlugins() { +function getWebpackPlugins() { const plugins = [ - new CheckerPlugin(), - new webpack.optimize.ModuleConcatenationPlugin(), new webpack.DefinePlugin({ __BUILD_TYPE__: JSON.stringify(env), __BUILD_ORIGIN__: JSON.stringify(buildOrigin), @@ -80,9 +77,8 @@ async function generateWebpackConfig() { mode: isProdBuild ? "production" : "development", optimization: { minimizer: [ - new UglifyJsPlugin({ - sourceMap: true, - uglifyOptions: { + new TerserPlugin({ + terserOptions: { sourceMap: true, compress: { drop_console: false, @@ -116,9 +112,9 @@ async function generateWebpackConfig() { exclude: /node_modules/, use: [ { - loader: "awesome-typescript-loader", + loader: "ts-loader", options: { - configFileName: "build/config/tsconfig.es6.json" + configFile: "build/config/tsconfig.es6.json" } }, ] @@ -134,8 +130,8 @@ async function generateWebpackConfig() { ] }, devtool: "source-map", - plugins: await getWebpackPlugins(), + plugins: getWebpackPlugins(), } } -module.exports = generateWebpackConfig(); +module.exports = generateWebpackConfig(); \ No newline at end of file