aboutsummaryrefslogtreecommitdiff
path: root/vnext/webpack.config.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-08 19:38:45 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit71c932eaf083c951cb534d71768ec8baa27c40b0 (patch)
tree18d16fa704eb5079729fabad3508fa3557f8c75b /vnext/webpack.config.js
parent282e499d6afb793f413e080d30c6cd219a78ef06 (diff)
uglifyjs -> terser
Diffstat (limited to 'vnext/webpack.config.js')
-rw-r--r--vnext/webpack.config.js63
1 files changed, 35 insertions, 28 deletions
diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js
index 3748e5db..821070f6 100644
--- a/vnext/webpack.config.js
+++ b/vnext/webpack.config.js
@@ -2,7 +2,7 @@ const webpack = require('webpack');
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin');
@@ -64,12 +64,42 @@ module.exports = (env, argv) => {
}
]
},
- optimization: {
+ plugins: [
+ new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+ new MiniCssExtractPlugin({
+ filename: 'Juick.[contenthash].css',
+ allChunks: true
+ }),
+ new HtmlWebPackPlugin({
+ template: './src/views/index.html',
+ filename: './index.html'
+ }),
+ new ErrorOverlayPlugin()
+ ],
+ devServer: {
+ bonjour: true,
+ historyApiFallback: true,
+ host: '0.0.0.0',
+ hot: true,
+ inline: true
+ }
+ };
+
+ if (dev) {
+ config.plugins.push(new webpack.HotModuleReplacementPlugin());
+ } else {
+ config.optimization = {
minimizer: [
- new UglifyJsPlugin({
+ new TerserPlugin({
cache: true,
parallel: true,
- sourceMap: dev
+ sourceMap: dev,
+ terserOptions: {
+ output: {
+ comments: /@license/i
+ }
+ },
+ extractComments: true
}),
new OptimizeCSSAssetsPlugin({})
],
@@ -94,30 +124,7 @@ module.exports = (env, argv) => {
}
}
}
- },
- plugins: [
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
- new MiniCssExtractPlugin({
- filename: 'Juick.[contenthash].css',
- allChunks: true
- }),
- new HtmlWebPackPlugin({
- template: './src/views/index.html',
- filename: './index.html'
- }),
- new ErrorOverlayPlugin()
- ],
- devServer: {
- bonjour: true,
- historyApiFallback: true,
- host: '0.0.0.0',
- hot: true,
- inline: true
- }
- };
-
- if (dev) {
- config.plugins.push(new webpack.HotModuleReplacementPlugin())
+ };
}
return config;
};