forked from ddrilling/asb_cloud_front
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
const path = require('path')
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
performance: {
|
|
assetFilter: (assetFilename) => !/\.map$/.test(assetFilename),
|
|
hints: 'warning',
|
|
maxAssetSize: 300 * 1024, // 300KB
|
|
},
|
|
cache: false,
|
|
output: {
|
|
path: path.resolve(__dirname, 'prod_build'),
|
|
pathinfo: false,
|
|
},
|
|
optimization: {
|
|
minimizer: [
|
|
new CssMinimizerPlugin(),
|
|
new TerserPlugin(),
|
|
],
|
|
flagIncludedChunks: true,
|
|
usedExports: true,
|
|
sideEffects: true,
|
|
concatenateModules: true,
|
|
emitOnErrors: false,
|
|
nodeEnv: 'production',
|
|
minimize: true,
|
|
},
|
|
stats: 'errors-warnings',
|
|
module: {
|
|
unsafeCache: false,
|
|
rules: [
|
|
{
|
|
test: /\.css$/i,
|
|
use: [
|
|
'style-loader',
|
|
'css-loader'
|
|
],
|
|
},
|
|
{
|
|
test: /\.less$/i,
|
|
use: [
|
|
'style-loader',
|
|
'css-loader',
|
|
{
|
|
loader: 'less-loader',
|
|
options: {
|
|
lessOptions: {
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
}
|
|
]
|
|
},
|
|
}
|