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

esbuild-bundle-analyzerのGithubActionを導入した #718

Merged
merged 1 commit into from
May 24, 2024

Conversation

yonta
Copy link
Collaborator

@yonta yonta commented May 24, 2024

fix #717

やったこと

  • たつのさんのesbuild-bundle-analyzerを導入した
    • esbuildのbundleサイズをコメントで出してくれるすごいやつ
    • 急に増えるのを監視したり、bundle最適化の効果だったりがわかるぞい。
  • 上記Action用にpackage.jsonにスクリプトを追加

やってないこと

  • esbuild v0.20系になるとCLIじゃなくてJSで書かないといけないかも?

@yonta yonta changed the title Add: esbuild-bundle-analyzerのGithubActionを導入した [esbuild-bundle-analyzerのGithubActionを導入した May 24, 2024
@yonta yonta changed the title [esbuild-bundle-analyzerのGithubActionを導入した esbuild-bundle-analyzerのGithubActionを導入した May 24, 2024
@yonta yonta force-pushed the pr/issue717/esbuild-bundle-analyzer branch from 5d99894 to aea69d8 Compare May 24, 2024 05:10
Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

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

"build": "esbuild app/javascript/*.* --bundle --sourcemap --define:global=window --outdir=app/assets/builds",

  • build スクリプトを esbuild CLI ではなく、API の方を使ったスクリプトに書き換える必要があります
  • そのスクリプトの中で metafile を書き出す 必要があります

@yonta yonta force-pushed the pr/issue717/esbuild-bundle-analyzer branch from aea69d8 to 855065e Compare May 24, 2024 05:16
Copy link

github-actions bot commented May 24, 2024

📦 esbuild Bundle Analysis for sakazuki

This analysis was generated by esbuild-bundle-analyzer. 🤖

Meta File Out File Size (raw) Note
meta.json app/assets/builds/application.js 1.01 MB 🆕 Added
Largest paths These visualization shows top 20 largest paths in the bundle.

Meta file: meta.json, Out file: app/assets/builds/application.js

Path Size
node_modules/chart.js/dist ${{\color{Goldenrod}{ ██████▊ }}}$ 27.4%, 273.88 KB
app/javascript/completion ${{\color{Goldenrod}{ ████▎ }}}$ 17.1%, 170.67 KB
node_modules/@hotwired/turbo ${{\color{Goldenrod}{ ███▎ }}}$ 13.2%, 131.96 KB
node_modules/bootstrap/dist ${{\color{Goldenrod}{ ███▏ }}}$ 12.5%, 124.34 KB
node_modules/simplelightbox/dist ${{\color{Goldenrod}{ ██▏ }}}$ 8.8%, 87.73 KB
node_modules/@hotwired/stimulus ${{\color{Goldenrod}{ ██ }}}$ 8.4%, 84.29 KB
node_modules/@popperjs/core ${{\color{Goldenrod}{ █▍ }}}$ 5.6%, 55.66 KB
node_modules/@rails/actioncable ${{\color{Goldenrod}{ ▌ }}}$ 2.0%, 19.51 KB
node_modules/rater-js/index.js ${{\color{Goldenrod}{ ▍ }}}$ 1.6%, 16.42 KB
node_modules/@kurkle/color ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 13.37 KB
app/javascript/taste_graph ${{\color{Goldenrod}{ ▏ }}}$ 0.8%, 7.56 KB
app/javascript/controllers ${{\color{Goldenrod}{ ▏ }}}$ 0.7%, 6.63 KB
node_modules/@hotwired/turbo-rails ${{\color{Goldenrod}{ }}}$ 0.4%, 3.82 KB
node_modules/ts-deepmerge/esm ${{\color{Goldenrod}{ }}}$ 0.2%, 1.69 KB
node_modules/just-zip-it/index.mjs ${{\color{Goldenrod}{ }}}$ 0.1%, 785 B
node_modules/chart.js/helpers ${{\color{Goldenrod}{ }}}$ 0.0%, 0 B
app/javascript/application.js ${{\color{Goldenrod}{ }}}$ 0.0%, 0 B
Details

Next to the size is how much the size has increased or decreased compared with the base branch of this PR.

  • ‼️: Size increased by 20% or more. Special attention should be given to this.
  • ⚠️: Size increased in acceptable range (lower than 20%).
  • ✅: No change or even downsized.
  • 🗑️: The out file is deleted: not found in base branch.
  • 🆕: The out file is newly found: will be added to base branch.

@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

情報助かる~~~。
metafile知らなかったので、いただいたドキュメント読んできます!

@yonta yonta force-pushed the pr/issue717/esbuild-bundle-analyzer branch from 855065e to db70c4c Compare May 24, 2024 05:26
@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

お、できたっぽい!

@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

え、うちのJSが90B!?そんな馬鹿な

@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

さすがに嘘だわ。手元のビルドだと983.8kbになる

@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

--bundle忘れてた!

@yonta yonta force-pushed the pr/issue717/esbuild-bundle-analyzer branch from db70c4c to f59e764 Compare May 24, 2024 05:33
@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

それっぽい結果になった。勝ったな!

@yonta
Copy link
Collaborator Author

yonta commented May 24, 2024

chartjsは予想通り大きい。

completionが大量の蔵や銘柄の生データだから重いな。
なんとか圧縮するほうほうがあるとより幸せになりそう。

@yonta yonta requested a review from momocus May 24, 2024 06:09
@yonta yonta self-assigned this May 24, 2024
@yonta yonta marked this pull request as ready for review May 24, 2024 06:09
package.json Show resolved Hide resolved
Copy link
Owner

@momocus momocus left a comment

Choose a reason for hiding this comment

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

おもろそうだし雑approveしま

@momocus momocus merged commit d81261c into main May 24, 2024
12 checks passed
@yonta yonta deleted the pr/issue717/esbuild-bundle-analyzer branch July 11, 2024 07:28
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.

Bundle Analyzerの導入
3 participants