You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newFriendlyErrorsWebpackPlugin({compilationSuccessInfo: {messages: ['You application is running here http://localhost:3000'],notes: ['Some additionnal notes to be displayed unpon successful compilation']},onErrors: function(severity,errors){// You can listen to errors transformed and prioritized by the plugin// severity can be 'error' or 'warning'},// should the console be cleared between each compilation?// default is trueclearConsole: true,// add formatters and transformers (see below)additionalFormatters: [],additionalTransformers: []}),
Activity
Genzhen commentedon Jun 23, 2020
1)优化 Webpack 的构建速度
注意:thread-loader 和 cache-loader 兩個要一起使用的話,請先放 cache-loader 接著是 thread-loader 最後才是 heavy-loader
2)使用webpack4-优化原因
①noParse
②IgnorePlugin
module.exports = {
plugins: [
new Webpack.IgnorePlugin(/./local/, /moment/),
]
}
③dillPlugin
④happypack -> thread-loader
⑤thread-loader
thread-loader 会将您的 loader 放置在一个 worker 池里面运行,以达到多线程构建。
把这个 loader 放置在其他 loader 之前(如下图 example 的位置), 放置在这个 loader 之后的 loader 就会在一个单独的 worker 池(worker pool)中运行。
每个 worker 都是一个单独的有 600ms 限制的 node.js 进程。同时跨进程的数据交换也会被限制。请在高开销的loader中使用,否则效果不佳
⑥压缩加速——开启多线程压缩
Webpack 4.0以前:uglifyjs-webpack-plugin,parallel参数
2)优化 Webpack 的打包体积
3)speed-measure-webpack-plugin
简称 SMP,分析出 Webpack 打包过程中 Loader 和 Plugin 的耗时,有助于找到构建过程中的性能瓶颈。
Genzhen commentedon Jun 23, 2020
开发阶段
1)开启多核压缩
插件:** terser-webpack-plugin **
2)监控面板
插件:speed-measure-webpack-plugin
在打包的时候显示出每一个loader,plugin所用的时间,来精准优化
3)开启一个通知面板
插件:webpack-build-notifier
4)开启打包进度
插件:progress-bar-webpack-plugin
5)开发面板更清晰
插件:webpack-dashboard
6)开启窗口的标题
node-bash-title
这个包mac的item用有效果,windows暂时没看到效果
7)friendly-errors-webpack-plugin
插件:friendly-errors-webpack-plugin
pws019 commentedon Jul 8, 2020
很硬核的知识,大白前来点赞,占楼先。
BruceYuj commentedon Jul 13, 2020
有个问题, includes 的效率比 indexOf 高吗? 我怎么看 chromium bug list 里面很多 benchmark 的结果是相反的
jacky-wang-design commentedon Aug 7, 2020
太牛逼了 看不懂