48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
|
const path = require("path");
|
||
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||
|
|
||
|
module.exports = {
|
||
|
mode: "development",
|
||
|
entry: './src/index.js',
|
||
|
output: {
|
||
|
filename: '[name].[contenthash].js',
|
||
|
path: path.resolve(__dirname, 'dist'),
|
||
|
clean: true
|
||
|
},
|
||
|
plugins: [
|
||
|
new HtmlWebpackPlugin({
|
||
|
title: "Capybara",
|
||
|
}),
|
||
|
new MiniCssExtractPlugin({
|
||
|
filename: "[name].[contenthash].css"
|
||
|
}),
|
||
|
],
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.css$/i,
|
||
|
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
optimization: {
|
||
|
moduleIds: 'deterministic',
|
||
|
runtimeChunk: 'single',
|
||
|
splitChunks: {
|
||
|
cacheGroups: {
|
||
|
vendor: {
|
||
|
test: /[\\/]node_modules[\\/]/,
|
||
|
name: 'vendors',
|
||
|
chunks: 'all',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
minimizer: [
|
||
|
`...`,
|
||
|
new CssMinimizerPlugin(),
|
||
|
]
|
||
|
},
|
||
|
};
|