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

feat: loadable component #1364

Merged
merged 3 commits into from
Dec 12, 2024
Merged

feat: loadable component #1364

merged 3 commits into from
Dec 12, 2024

Conversation

mark86092
Copy link
Contributor

@mark86092 mark86092 commented Jun 25, 2024

Close #

這個 PR 是?

等公司資料合併上線後再來 merge

將比較大包的 js 拆分成小包,僅當需要使用的時候才讀取

  460.38 KB (+141.91 KB)  build/public/static/js/bundle.2634ec13.js
  27.15 KB                build/public/static/css/bundle.2634ec13.css
  114 B                   build/chunks.json

PR 改動:

  318.47 KB (+2 B)  build/public/static/js/bundle.85b12935.js                                                           
  134.66 KB         build/public/static/js/0.ab8bda49.chunk.js                                                          
  27.15 KB          build/public/static/css/bundle.85b12935.css
  1.12 KB           build/public/static/js/1.b04cdc02.chunk.js                                         
  178 B             build/chunks.json

背景知識

這個套件是透過 https://loadable-components.com/ 來達成 dynamic import

新版的 react 應該會支援更好,但我們還沒升級

我應該從何看起?

請見 comment

我應該如何手動測試?

setup: npm run build, npm run start-production (目的是看 build 後的 request)

附錄1

拜訪 http://localhost:3000/companies

image

可以發現只讀取 bundle.85b12935.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

這個檔案原本取名拼字有錯

</div>
<div className={styles.barChartSm}>
<JobTitleDistrubitionChart data={jobAverageSalaries} />
<JobTitleDistributionChart data={jobAverageSalaries} />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

原拼字有誤,修正 naming

@mark86092 mark86092 changed the title wip: feat: loadable component (PR 可 review, 只是不急著 merge) feat: loadable component (PR 可 review, 只是不急著 merge) Dec 4, 2024
@mark86092 mark86092 changed the title feat: loadable component (PR 可 review, 只是不急著 merge) feat: loadable component Dec 4, 2024
@mark86092 mark86092 requested a review from a team December 10, 2024 01:22
@mark86092 mark86092 merged commit cf90348 into master Dec 12, 2024
8 checks passed
@mark86092 mark86092 deleted the loadable branch December 12, 2024 05:38
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.

2 participants