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");
|
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
|
|
|
}, {
|
|
|
|
test: /\.(png|jpg|gif)$/,
|
|
|
|
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')
|
|
|
|
})
|
|
|
|
]
|
2019-04-09 00:21:00 +02:00
|
|
|
})
|