webpack: remove eslint, added terser optimization in prod build
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
|
||||
const utils = require('./utils')
|
||||
|
||||
@@ -25,16 +25,16 @@ module.exports = {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|vue)$/,
|
||||
loader: 'eslint-loader',
|
||||
enforce: 'pre',
|
||||
exclude: /node_modules/,
|
||||
options: {
|
||||
emitError: true,
|
||||
emitWarning: true
|
||||
}
|
||||
},
|
||||
// {
|
||||
// test: /\.(js|vue)$/,
|
||||
// loader: 'eslint-loader',
|
||||
// enforce: 'pre',
|
||||
// exclude: /node_modules/,
|
||||
// options: {
|
||||
// emitError: true,
|
||||
// emitWarning: true
|
||||
// }
|
||||
// },
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: 'vue-loader'
|
||||
@@ -82,5 +82,6 @@ module.exports = {
|
||||
filename: '[name].css'
|
||||
}),
|
||||
new VueLoaderPlugin()
|
||||
// new ESLintPlugin()
|
||||
]
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
|
||||
module.exports = merge(baseConfig, {
|
||||
mode: 'development',
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
@@ -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: []
|
||||
})
|
||||
|
Reference in New Issue
Block a user