materio-d9/build/webpack.config.prod.js

70 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

'use strict'
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');
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: [
{
test: /\.css?$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
}, {
test: /\.scss?$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
}, {
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 5000
}
}
]
}
]
},
plugins: [
// new MiniCssExtractPlugin({
// filename: 'main.css'
// })
]
})