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

[优化]减小项目打包的体积 #101

Open
1 task
Tracked by #38
521xueweihan opened this issue Apr 18, 2023 · 3 comments
Open
1 task
Tracked by #38

[优化]减小项目打包的体积 #101

521xueweihan opened this issue Apr 18, 2023 · 3 comments

Comments

@521xueweihan
Copy link
Member

521xueweihan commented Apr 18, 2023

  • 降低项目打包后的体积,减小 First Load JS

Image

@521xueweihan 521xueweihan converted this from a draft issue Apr 18, 2023
@521xueweihan 521xueweihan changed the title [优化]减小打包后的体积 [优化]减小项目打包的体积 Apr 18, 2023
@521xueweihan 521xueweihan moved this from 待开发 to 开发中 in Geese Apr 18, 2023
@521xueweihan 521xueweihan moved this from 开发中 to 待开发 in Geese Apr 18, 2023
@cqh963852
Copy link
Collaborator

"@next/bundle-analyzer": "^12.3.1",

这一行移动到 devDependencies 中。属于开发依赖。(和本主题无关)

@KonghaYao
Copy link

看了一下代码,发现飘红的路径,好像用到了 MDRender,可能是这个地方有点占空间

@aolyang
Copy link

aolyang commented May 21, 2024

瞅了一眼 contribution guide (实际藏在docs/content.md 一开始没找到,我在写这个评论时刻意找了以下才发现)

开发须知在这里

这个实在是眼拙没看到,建议写个大大的 CONTRIBUTION 参考github推荐: https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors

所以,我就仅dev后直接改代码试了下build,效果如下(改了user, repository)。

image

内容很简单,就是按照数据加载逻辑,把某些渲染开销大的组件直接丢到React.lazy

优化前 优化后
1716258911489 1716258894502

目前来说有两个大的需要考虑:

  1. 页面的结构更详细的通过Layout 和 Leaf Component区分
  2. 根据Layout直接加载,Leaf可以任意异步 加载的逻辑,将大部分Leaf调整为异步加载,data fetch可以按Leaf组件重新设计接口,避免在根路由一股脑请求完所有数据

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 待开发
Development

No branches or pull requests

4 participants