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

优化总结 #112

Open
whjin opened this issue Nov 9, 2023 · 0 comments
Open

优化总结 #112

whjin opened this issue Nov 9, 2023 · 0 comments

Comments

@whjin
Copy link
Owner

whjin commented Nov 9, 2023

优化总结

本章从开发体验和输出质量两个角度讲解了如何优化项目中的 Webpack 配置,这些优化的方法都是来自项目实战中的经验积累。 虽然每一小节都是一个个独立的优化方法,但是有些优化方法并不冲突可以相互组合,以达到最佳的效果。

以下将给出是结合了本章所有优化方法的实例项目,由于构建速度和输出质量不能兼得,按照开发环境和线上环境为该项目配置了两份文件,分别如下:

侧重优化开发体验的配置文件 webpack.config.js

See the Pen webpack-dist.config.js by whjin (@whjin) on CodePen.

<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

本章介绍的优化方法虽然难以涵盖 Webpack 的方方面面,但足以解决实战中常见的场景。 对于本书没有介绍到的场景,你需要根据自己的需求按照以下思路去优化:

  1. 找出问题的原因;
  2. 找出解决问题的方法;
  3. 寻找解决问题方法对应的 Webpack 集成方案。

同时你还需要跟紧社区的迭代,学习他人的优化方法,了解最新的 Webpack 特性和新涌现出的插件、Loader。

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