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 如何优化 Webpack 的构建速度 #22

Open
leslie1943 opened this issue Nov 20, 2020 · 0 comments
Open

Webpack 如何优化 Webpack 的构建速度 #22

leslie1943 opened this issue Nov 20, 2020 · 0 comments

Comments

@leslie1943
Copy link
Owner

leslie1943 commented Nov 20, 2020

如何优化 Webpack 的构建速度

  • 使用高版本的 Webpack 和 Node.js
  • 多进程/多实例构建: thread-loader
  • 压缩代码
# terser-webpack-plugin / uglifyjs-webpack-plugin 压缩JS代码
# 图片压缩: 基于 Node 库的 imagemin /  image-webpack-loader
# 缩小打包作用域: exclude / include; resolve.modules指明第三模块的绝对路径; 
# resolve.extension 减少后缀尝试的可能性; 合理使用别名
# 提取共通资源
# DLL: 使用DllPlugin进行分别,缓存打包的静态资源,避免反复编译
# 开启Tree shaking
@leslie1943 leslie1943 changed the title 如何优化 Webpack 的构建速度 Webpack 如何优化 Webpack 的构建速度 Nov 20, 2020
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