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

fix: let async imports bundled into separate chunks #939

Closed
wants to merge 1 commit into from

Conversation

xusd320
Copy link
Contributor

@xusd320 xusd320 commented Mar 11, 2024

  1. 解决形如 import(./i18n/${lang}) 这类动态 import 会将 i18n/ 目录下所有文件打包进一个 async chunk 的问题;
  2. 增加相应 e2e 用例。

@xusd320 xusd320 requested review from sorrycc and PeachScript March 11, 2024 08:25
@@ -156,6 +161,10 @@ impl VisitMut for ContextModuleVisitor {
// require('./i18n' + n) -> require('./i18n?context&glob=**/*')('.' + n)
expr.callee = ctxt_call_expr.as_callee();
} else {
// mark async import in params
ctxt_call_expr.args =
vec![quote_str!(format!("{}?context&glob={}&async", from, glob)).as_arg()];
Copy link
Member

@PeachScript PeachScript Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提取下 basic_arg

@sorrycc
Copy link
Member

sorrycc commented Mar 11, 2024

这个要紧急发?不是的话还是提 pr 到 #923 吧,#923 用例全过了,明天合。

@xusd320 xusd320 force-pushed the fix/async-split-chunks branch from 855a1ac to 63a3195 Compare March 11, 2024 09:12
@xusd320 xusd320 closed this Mar 11, 2024
@stormslowly stormslowly deleted the fix/async-split-chunks branch March 25, 2024 05:24
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.

3 participants