homepage/config/webpack.prod.js

56 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-03-14 07:16:12 +00:00
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const { merge } = require('webpack-merge')
const paths = require('./paths')
const common = require('./webpack.common')
module.exports = merge(common, {
mode: 'production',
devtool: false,
output: {
path: paths.build,
2023-03-16 07:54:45 +00:00
publicPath: '/assets/',
2023-03-14 07:16:12 +00:00
filename: 'js/[name].[contenthash].bundle.js',
},
module: {
rules: [
{
test: /\.(sass|scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 2,
sourceMap: false,
modules: false,
},
},
'postcss-loader',
'sass-loader',
],
},
],
},
plugins: [
// Extracts CSS into separate files
new MiniCssExtractPlugin({
2023-03-16 07:54:45 +00:00
filename: '_scss/[name].[contenthash].css',
2023-03-14 07:16:12 +00:00
chunkFilename: '[id].css',
}),
],
optimization: {
minimize: true,
minimizer: [new CssMinimizerPlugin(), '...'],
runtimeChunk: {
name: 'runtime',
},
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
})