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, use: ['style-loader', 'css-loader', 'postcss-loader'], }, { 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 }], ], }, }, }), ], }, }