在引入第三方库的时候会有一些说明文档会被自动提取出来,如果要禁止掉就配置TerserPlugin
    image.png0
    terser-webpack-plugin 在webpack5之后是webpack内置的,但是需要再引入

    1. const TerserPlugin = require('terser-webpack-plugin');
    2. const path = require('path');
    3. module.exports = {
    4. mode: 'production',
    5. entry: './src/index.js',
    6. output: {
    7. filename: '[name].bundle.js',
    8. path: path.resolve(__dirname, 'dist'),
    9. clean: true,
    10. },
    11. optimization: {
    12. minimizer: [
    13. new TerserPlugin({
    14. extractComments: false,
    15. }),
    16. ],
    17. },
    18. };