-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
refactor: change route preonload inline to ref #12398
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Walkthrough这些更改主要涉及在 Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 (
|
Size Change: +241 B (0%) Total Size: 9.9 MB
ℹ️ View Unchanged
|
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts
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.
+1
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts
@@ -306,6 +291,36 @@ export default (api: IApi) => { | |||
.value() as any, | |||
}; | |||
} | |||
if (api.name === 'build' && routeChunkFilesMap && !api.config.tern) { |
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.
api.name === 'build' && routeChunkFilesMap
↑ 这个条件,在上面的代码也有,最好把它提取出来复用,比如叫 isEnableRoutePreload()
。
packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts
Show resolved
Hide resolved
join(api.paths.absOutputPath, `${PRELOAD_ROUTE_HELPER}${hashedPart}`), | ||
content, | ||
), | ||
'utf-8'; |
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.
这是怎么漂移了。
在本地 commit 提交代码 → GitHub 发起 PR → CI 跑到绿色 这个流程中,建议一定要做两次代码检查:
-
第一次是改好了代码,在本地 commit 要编写 commit msg 前,先在 vscode 或者某些 git 可视化代码管理工具里,看一下你 change 部分的代码有没有问题,一定要浏览一遍,比如这个时候,那些明显的错误或者 console.log 等的遗留就可以避免。
-
第二次是在 GitHub 打开 PR 后,在 files 的 tab 里,再人工浏览过一遍代码,看看有没有上一次检查没发现的问题,同时再想一下,这个 PR 里的代码有没有 edge case ,有的话就再补充或修订,从而可以避免再返工的绝大多数问题。
在业务项目的代码里没必要做 2 次 check ,往往做 1 次本地 vscode git 可视化 change 浏览就可以了;你要提到 umi 仓库里的话,一定要谨慎再谨慎,本来 umi 的名声就不是特别好,不期望代码里漏洞百出被抓到把柄被黑,希望能逐渐提升锻炼到一次 PR 即成功,不存在明显的错误。
下次提 PR 的时候可以把自己的 GitHub id 加到根目录的 |
Summary by CodeRabbit
新功能
PRELOAD_ROUTE_HELPER
常量以增强路由预加载功能。改进