2024-02-06 22:07:08 +00:00
|
|
|
const path = require('path');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: './src/main.js',
|
|
|
|
output: {
|
|
|
|
filename: "bundle.js",
|
|
|
|
clean: true,
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/i,
|
2024-02-06 23:51:11 +00:00
|
|
|
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
2024-02-06 22:07:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|gif|jpe?g|webp|svg)$/i,
|
|
|
|
type: "asset",
|
|
|
|
// use: ['file-loader'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff|woff2|otf|ttf|eot)$/i,
|
|
|
|
type: "asset/resource",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: "./src/template.html",
|
|
|
|
})
|
|
|
|
],
|
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new ImageMinimizerPlugin({
|
|
|
|
minimizer: {
|
|
|
|
implementation: ImageMinimizerPlugin.imageminMinify,
|
|
|
|
options: {
|
|
|
|
plugins: [
|
|
|
|
// ["gifsicle", { interlaced: true }],
|
|
|
|
["jpegtran", { progressive: true }],
|
|
|
|
// ["optipng", { optimizationLevel: 5 }],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|