webpack: remove eslint, added terser optimization in prod build

This commit is contained in:
2020-11-25 15:25:57 +01:00
parent c12f72e3fe
commit f002c81008
7 changed files with 3624 additions and 2326 deletions

View File

@@ -4,35 +4,10 @@ const webpack = require('webpack')
const merge = require('webpack-merge')
const baseConfig = require('./webpack.config.base')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = merge(baseConfig, {
mode: 'production',
optimization: {
minimizer: [
new UglifyJSPlugin({
uglifyOptions: {
// Eliminate comments
comments: false,
// remove warnings
warnings: false,
compress: {
// Drop console statements
drop_console: true,
}
}
})
]
// splitChunks: {
// cacheGroups: {
// commons: {
// test: /[\\/]node_modules[\\/]/,
// name: "vendor",
// chunks: "all",
// },
// },
// },
},
module: {
rules: [
{
@@ -61,9 +36,22 @@ module.exports = merge(baseConfig, {
}
]
},
plugins: [
// new MiniCssExtractPlugin({
// filename: 'main.css'
// })
]
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
sourceMap: true, // Must be set to true if using source-maps in production
parallel: true,
test: /\.(js|vue)$/,
// extractComments: true
terserOptions: {
compress: {
drop_console: true,
},
},
})
],
},
// ,
// plugins: []
})