webpack中文网的错误&&未更新内容(webpack4)

https://www.webpackjs.com/guides/

截止到2020/07/24还存在的错误

(一)(管理输出部分)清理dist文件夹无用文件的插件:

clean-webpack-plugin

引用地址:https://www.jianshu.com/p/0e99366ce796

使用步骤:

cnpm install clean-webpack-plugin --save-dev

在webpack.config.js配置文件中

const {CleanWebpackPlugin} = require(‘clean-webpack-plugin‘);
plugins: [
     new CleanWebpackPlugin()
... ],

(二)(代码分离部分)防止重复,将一些公用的插件提取出来单独打包:

引用地址:https://blog.csdn.net/github_36487770/article/details/80228147?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

CommonsChunkPlugin

使用步骤:不需要cnpm安装

在webpack.config.js配置文件中

const webpack = require(‘webpack‘);
 optimization: {
    splitChunks: {
        cacheGroups: {
            commons: {
                name: "commons",
                chunks: "initial",
                minChunks: 2
            }
        }
    }
}

but,里面各项参数变复杂了....

 

webpack中文网的错误&&未更新内容(webpack4)

上一篇:html DOM 01 节点概念


下一篇:js 浏览器窗口 刷新、关闭事件