Which mode should I take in the webpack?

I’m learning how to config webpack.Today I meet some problems.I tried test the result with the configuration of prefetch,so my index.js file was just like this.

//index.js
import hello from './hello';
import imgsrc from './asset/千峰教育.png';
import logoSVG from './asset/千峰教育.svg';
import exampleTxt from './asset/example.txt';
import jpgMap from './asset/Stack Overflow.jpg';
import './style.css';
import './style.less';
import Data from './asset/data.xml';
import Notes from './asset/data.csv';
//import toml from './asset/data.toml';
//import yaml from './asset/data.yaml';
//import json5 from './asset/data.json5';
import _ from 'lodash';
import './async-module.js';

hello();
const img = document.createElement('img');
img.src = imgsrc;
document.body.appendChild(img);

const img2 = document.createElement('img');
img2.style.cssText = 'width:600px;height:200px'
img2.src = logoSVG;
document.body.appendChild(img2);

const block = document.createElement('div');
block.style.cssText = 'width:200px;height:200px;background:aliceblue';
block.classList.add('block-bg');
block.textContent = exampleTxt;
document.body.appendChild(block);

const img3 = document.createElement('img');
img3.style.cssText = 'width:600px;height:240px;display:block;';
img3.src = jpgMap;
document.body.appendChild(img3);

document.body.classList.add('hello');

console.log(Data);
console.log(Notes);
/*
console.log(toml.title);
console.log(toml.owner.name);

console.log(yaml.title);
console.log(yaml.owner.name);

console.log(json5.title);
console.log(json5.owner.name);*/

console.log(_.join(['index', 'module', 'loaded!'], ' '));

const button = document.createElement('button');
button.textContent = '点击执行加法运算';
button.addEventListener('click', () => {
    import(/*webpackChunkName:'math',webpackPrefetch:true*/'./math.js').then(({ add }) => {     //将add方法从math.js模块中解构出来
        console.log(add(4, 5));
    });
});
document.body.appendChild(button);

The code block may be a little too long,but it doesn’t matter.Please focus on the configuration of ‘webpackPrefetch:true’.When I run the project in the development mode,it didn’t throw an error in the console.However,when I open the browser and login the html,the browser shows that installedCssChunks is not defined.

npx webpack
npx webpack-dev-server
//webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const toml = require('toml');
const yaml = require('yaml');
const json5 = require('json5');

module.exports = {
    entry: {
        /*
        index: {
            import: './src/index.js',
            dependOn: 'shared'
        },

        another: {
            import: './src/another-module.js',
            dependOn: 'shared'
        },

        shared: 'lodash'*/
        index: './src/index.js',
        another: './src/another-module.js'
    },

    output: {
        filename: '[name].bundle.js',
        //path必须是绝对路径
        path: path.resolve(__dirname, './dist'),
        clean: true,    //清理生成目录中没有用到的文件
        assetModuleFilename: 'images/[contenthash][ext]'    //指定打包后的文件夹和名称
    },

    mode: 'development',

    devtool: 'inline-source-map',

    plugins: [
        new HtmlWebpackPlugin({
            template: './index.html',
            filename: 'app.html',
            inject: 'body'
        }),

        new MiniCssExtractPlugin({    //创建插件实例对象
            filename: 'styles/[contenthash].css'     //设置打包后的CSS的文件名称
        })
    ],

    devServer: {
        //该选项允许配置从目录提供静态文件的选项(默认是'public'文件夹)
        static: './dist'
    },

    module: {
        rules: [
            {
                test: /.png$/,
                type: 'asset/resource',
                generator: {    //generator优先级高于assetModuleFilename优先级
                    filename: 'images/[contenthash][ext]'
                }
            },
            {
                test: /.svg$/,
                type: 'asset/inline'
            },
            {
                test: /.txt$/,
                type: 'asset/source'
            },
            {
                test: /.jpg$/,
                type: 'asset',
                parser: {
                    dataUrlCondition: {
                        maxSize: 4 * 1024 * 1024
                    }
                }
            },
            {
                test: /.(css|less)/,
                //采用CSS的压缩插件以压缩生成后的CSS文件大小
                use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']
            },
            {
                test: /.(woff|woff2|eot|ttf|otf)/,    //加载字体类型的资源
                type: 'asset/resource'
            },
            {
                test: /.(csv|tsv)$/,
                use: 'csv-loader'
            },
            {
                test: /.xml$/,
                use: 'xml-loader'
            },
            {
                test: /.toml$/,
                type: 'json',
                parser: {
                    parse: toml.parse
                }
            },
            {
                test: /.yaml$/,
                type: 'json',
                parser: {
                    parse: yaml.parse
                }
            },
            {
                test: /.json5$/,
                type: 'json',
                parser: {
                    parse: json5.parse
                }
            },
            {
                test: /.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env'],
                        plugins: [
                            ['@babel/plugin-transform-runtime']
                        ]
                    }
                }
            }
        ]
    },

    optimization: {
        minimizer: [
            new CssMinimizerPlugin()
        ],

        splitChunks: {
            chunks: 'all'
        }
    }
}

The content in the development mode

The error in the development mode
I felt so confused that I asked AI.AI answered that the third plugin MiniCssExtractPlugin should be used in the production mode,and the configuration of webpackPrefetch should also in the production mode.Because both of them prefer compressing to debugging.
In this case,I changed the mode to production and didn’t change other things.When I run the project secondly,it became even worse that the console threw two warnings.
The content in the production mode

The error and warnings in the production mode

It appears that the installedCssChunks is not defined in both of these modes.I don’t know which mode should I take and how to solve these problems.Who could help me?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật