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

refactor: optimize bundle size of lite web ide #1953

Merged
merged 24 commits into from
Nov 24, 2022
Merged

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Nov 10, 2022

Types

  • 🪚 Refactors

Background or solution

关联 PR opensumi/ide-startup-lite#35

主要修改点如下:

  • 整合 encode 工具方法至 @opensumi/ide-utils
  • 移除了 Extension 进程对 Debug 代码的直接引用,包大小减少约 500kb
  • 移除了多余的 iconv-lite,jschardet 依赖
  • 移除了错误的 lodash 引入方式
  • 移除了 antd-theme 实例代码

生产模式下包大小从 18.52MB 降至 18.24MB,瘦身效果较少,后续可以继续优化的方向:

  • 部分工具库的延时加载,如 jschardet
  • 移除框架内多余的组件,如 @opensumi/ide-core-browser 内的 Tree 及 Scroller 组件

Changelog

optimize bundle size of lite web ide

@github-actions github-actions bot added the ⚙️ refactor Refactor code label Nov 10, 2022
@erha19
Copy link
Member Author

erha19 commented Nov 14, 2022

修改后仅 OpenSumi 包大小带来的变化:

Before:

image

After:

image

@erha19 erha19 added this to the 2.22 milestone Nov 14, 2022
@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Base: 57.44% // Head: 57.44% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (7377c91) compared to base (90c434f).
Patch coverage: 93.26% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1953   +/-   ##
=======================================
  Coverage   57.44%   57.44%           
=======================================
  Files        1289     1291    +2     
  Lines       80695    80604   -91     
  Branches    16880    16822   -58     
=======================================
- Hits        46352    46304   -48     
+ Misses      31221    31177   -44     
- Partials     3122     3123    +1     
Flag Coverage Δ
jsdom 52.28% <85.57%> (+0.08%) ⬆️
node 15.77% <15.38%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/file-service/src/common/files.ts 86.84% <ø> (ø)
...file-service/src/node/disk-file-system.provider.ts 78.46% <ø> (ø)
packages/utils/src/encoding.ts 61.24% <33.33%> (-0.75%) ⬇️
...scode/api/debug/extension-debug-session-factory.ts 43.47% <75.00%> (+1.25%) ⬆️
...ackages/debug/src/browser/debug-session-manager.ts 66.33% <100.00%> (-0.11%) ⬇️
packages/debug/src/browser/debug-session.ts 10.84% <100.00%> (ø)
...es/debug/src/browser/editor/debug-model-manager.ts 25.58% <100.00%> (-2.78%) ⬇️
packages/debug/src/browser/index.ts 93.93% <100.00%> (-1.72%) ⬇️
packages/debug/src/browser/model/debug-source.ts 81.66% <100.00%> (ø)
packages/debug/src/browser/model/debug-watch.ts 91.42% <100.00%> (-0.13%) ⬇️
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bytemain
Copy link
Member

fantastic!

Copy link
Member

@bytemain bytemain left a comment

Choose a reason for hiding this comment

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

太长了,但 LGTM
测试过了就合了吧

@erha19 erha19 merged commit 9f3b005 into main Nov 24, 2022
@erha19 erha19 deleted the refactor/minify-bundle-size branch November 24, 2022 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ refactor Refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants