Revert "fix:dynamic import as namespace import (#1171)"#1208
Revert "fix:dynamic import as namespace import (#1171)"#1208stormslowly merged 1 commit intomasterfrom
Conversation
This reverts commit 5ad6f5f.
漫游这次更改涉及多个文件,主要集中在动态导入和模块上下文的调整,以及运行时函数的变更。代码结构和导入机制得到了优化,提高了代码的可读性和效率。 变更
诗歌
Tip Early Access Features
Note Pull Request Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
* Reapply "fix:dynamic import as namespace import (#1171)" (#1208) This reverts commit 6e69d85. * release: @umijs/mako@0.4.18-canary.20240528.5 * chore: ⬆️ update pnpm-lock * release: @umijs/mako@0.5.5-canary.20240606.1 --------- Co-authored-by: Jinbao1001 <nodewebli@gmail.com> Co-authored-by: sorrycc <sorrycc@gmail.com>
This reverts commit 5ad6f5f.
Summary by CodeRabbit
transform.rs和bundless_compiler.rs中的transform_js_generate函数中,将dynamic_import的初始化更改为使用结构体初始化,并为context赋值,而不是使用DynamicImport::new与context和dep_map一起调用。app_runtime.stpl的createRuntime函数中删除了requireModule.dr函数,影响了动态块加载机制。expect.js文件中,更新了__mako_require__.dr到__mako_require__.bind的函数调用,用于在异步块中为不同的JSON文件(zh-CN.json和en-US.json)生成上下文模块的moduleReg函数。index.ts的loadLangExt函数中,重构了功能,改用import代替import和require的组合,简化了代码结构并提高了可读性。该函数现在直接返回动态导入操作的结果。