Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack-优化 #18

Open
PleaseStartYourPerformance opened this issue Aug 4, 2020 · 0 comments
Open

Webpack-优化 #18

PleaseStartYourPerformance opened this issue Aug 4, 2020 · 0 comments

Comments

@PleaseStartYourPerformance
Copy link
Owner

PleaseStartYourPerformance commented Aug 4, 2020

BundleAnalyzerPlugin

分析资源大小

SpeedMeasurePlugin

分析每个步骤花费的时间
优化工具

hard-source-webpack-plugin

可以看到,启用这个插件后,loader不占用1s编译时间。因为上次所有的编译内容都被缓存了,新的编译只需要做增量编译即可,不需要重复编译。
image

安装

npm install --save-dev hard-source-webpack-plugin
# or
yarn add --dev hard-source-webpack-plugin

配置

// webpack.config.js
var HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

module.exports = {
  context: // ...
  entry: // ...
  output: // ...
  plugins: [
    new HardSourceWebpackPlugin()
  ]
}

HardSourceWebpackPlugin 和 speed-measure-webpack-plugin 不能一起使用

原文链接

https://juejin.im/post/6887863430510968839?utm_source=gold_browser_extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant