From b204f1b572c8b146734e0a769c499ae0242498ed Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 9 Apr 2024 14:24:45 -0400 Subject: [PATCH] fix: replace outdated webpack plugins --- webpack.prod.config.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/webpack.prod.config.js b/webpack.prod.config.js index dff33295bb59..c8da4ff19370 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -6,6 +6,7 @@ var Merge = require('webpack-merge'); var webpack = require('webpack'); var BundleTracker = require('webpack-bundle-tracker'); var _ = require('underscore'); +const TerserPlugin = require("terser-webpack-plugin"); var commonConfig = require('./webpack.common.config.js'); @@ -22,16 +23,14 @@ var optimizedConfig = Merge.smart(commonConfig, { }), new webpack.LoaderOptionsPlugin({ // This may not be needed; legacy option for loaders written for webpack 1 minimize: true - }), - new webpack.optimize.UglifyJsPlugin(), - new webpack.optimize.CommonsChunkPlugin({ - // If the value below changes, update the render_bundle call in - // common/djangoapps/pipeline_mako/templates/static_content.html - name: 'commons', - filename: 'commons.[chunkhash].js', - minChunks: 3 }) - ] + ], + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin(), + ], + } } }); @@ -52,16 +51,7 @@ var requireCompatConfig = Merge.smart(optimizedConfig, { web: { output: { filename: '[name].js' - }, - plugins: [ - new webpack.optimize.CommonsChunkPlugin({ - // If the value below changes, update the render_bundle call in - // common/djangoapps/pipeline_mako/templates/static_content.html - name: 'commons', - filename: 'commons.js', - minChunks: 3 - }) - ] + } } });