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

enhance tree shaking for ESM module when split chunks. #2949

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

huadong
Copy link

@huadong huadong commented Oct 21, 2021

当进行分包优化时候,对Tree shaking进行进一步分析,把分包间接引入的模块拆分到分包中。
比如:

  1. 小程序有PA、PB两个分包
  2. 引入ESM依赖包A
  3. A包中有a, b, c三个模块
  4. 其中A.c被主包页面引入使用,A.a被分包PA使用,A.b被分包PB使用
  5. 优化前a, b, c三个模块均会被打包到主包的vender.js中。
  6. 优化后c被打包到主包,a被打包到PA包,b被打包到PB包。

参考测试项目:https://github.com/huadong/weapp-subpackages-optimization

 module when split chunks.
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

Successfully merging this pull request may close these issues.

2 participants