2019-04-09 00:21:00 +02:00
|
|
|
'use strict'
|
|
|
|
|
2019-06-06 17:37:43 +02:00
|
|
|
const webpack = require('webpack')
|
2020-11-25 21:39:40 +01:00
|
|
|
const { merge } = require('webpack-merge')
|
2019-04-09 00:21:00 +02:00
|
|
|
const baseConfig = require('./webpack.config.base')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
2020-11-25 15:25:57 +01:00
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
2021-04-05 20:58:54 +02:00
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
2019-04-09 00:21:00 +02:00
|
|
|
|
|
|
|
module.exports = merge(baseConfig, {
|
|
|
|
mode: 'production',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css?$/,
|
|
|
|
use: [
|
2021-03-19 16:06:06 +01:00
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: '',
|
|
|
|
},
|
|
|
|
},
|
2019-04-09 00:21:00 +02:00
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
}, {
|
2019-06-06 17:37:43 +02:00
|
|
|
test: /\.scss?$/,
|
2019-04-09 00:21:00 +02:00
|
|
|
use: [
|
2021-03-19 16:06:06 +01:00
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: '',
|
|
|
|
},
|
|
|
|
},
|
2019-04-09 00:21:00 +02:00
|
|
|
'css-loader',
|
|
|
|
'sass-loader'
|
|
|
|
]
|
2019-06-17 14:07:27 +02:00
|
|
|
}, {
|
2021-03-29 22:28:24 +02:00
|
|
|
test: /\.(png|jpg|gif|svg)$/,
|
2019-06-17 14:07:27 +02:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 5000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2019-04-09 00:21:00 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2020-11-25 15:25:57 +01:00
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
|
|
|
parallel: true,
|
|
|
|
test: /\.(js|vue)$/,
|
|
|
|
// extractComments: true
|
|
|
|
terserOptions: {
|
|
|
|
compress: {
|
2020-11-25 21:39:40 +01:00
|
|
|
// drop_console: true,
|
|
|
|
pure_funcs: [
|
|
|
|
'console.log',
|
|
|
|
'console.info',
|
|
|
|
'console.debug'
|
|
|
|
// 'console.warn'
|
|
|
|
]
|
2020-11-25 15:25:57 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
],
|
|
|
|
},
|
2020-11-25 21:39:40 +01:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('production')
|
2021-04-05 20:58:54 +02:00
|
|
|
}),
|
|
|
|
new BundleAnalyzerPlugin({
|
|
|
|
'analyzerMode': 'static'
|
2020-11-25 21:39:40 +01:00
|
|
|
})
|
|
|
|
]
|
2019-04-09 00:21:00 +02:00
|
|
|
})
|