guild_front/config/webpack/prod.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

const paths = require('../paths');
const {merge} = require('webpack-merge');
const common = require('./common');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = merge(common, {
mode: 'production',
target :'browserslist',
entry: {
index: {
import: `${paths.src}/index.js`,
dependOn: ['react', 'helpers']
},
react: ['react', 'react-dom', 'prop-types'],
helpers: ['immer', 'nanoid']
},
devtool: false,
output: {
filename: 'js/[name].[hash:8].bundle.js',
publicPath: '/',
2023-01-23 15:25:29 +03:00
assetModuleFilename: '[hash][ext][query]'
},
module: {
rules: [
{
test: /\.(c|sa|sc)ss$/i,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {importLoaders: 1}
},
'postcss-loader',
'sass-loader'
]
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
2023-01-23 15:08:29 +03:00
type: 'asset/resource'
// type: 'asset'
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
chunkFilename: '[id].css'
}),
],
optimization: {
runtimeChunk: 'single'
},
performance: {
hints: 'warning',
maxEntrypointSize: 512000,
maxAssetSize: 512000
}
});