-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat(tree-shaking):skip-module according to side-effects #807
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
we just need a banana not a gorilla
(according to webpack naming)
sorrycc
requested changes
Dec 21, 2023
|
||
pub fn analyze_deps( | ||
ast: &ModuleAst, | ||
task: &Task, | ||
file_path: &String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个没特别的理由不要调整。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有,skip modules 之后,ast 会变化,ast 需要重新分析,这个时候分析deps 是没有 task 这个概念的。
sorrycc
approved these changes
Dec 25, 2023
delete-merged-branch
bot
deleted the
feat/re_export_with_side_effects
branch
December 25, 2023 02:04
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #727
尺寸性能
bigfish 模板项目
120% = 3284/2736
-->110.8% =3032/2736
solution Overview
step 1. 首先确定 proxy 模块没有副作用,
step 2. 分析 import specifiers from "proxy" 或者 export specifier from "proxy", 得到需要从 proxy 模块中引用的符号 ident,
step 3. 使用 ident 在 proxy 模块查找它的来源模块和对应的引用符号 ident',继续查找;查找的结束条件
step 4. 替换原始模块中 ident 的导入方式
step 5 重新分析模块依赖信息,重建对应的 tree-shaking 模块中的 statement graph 和 语句 exports 信息
detail
wip 内部分享