chaynHQ / soulmedicine

Soul Medicine a multilingual digital service designed to deliver critical safety information and supportive messaging in bite-sized pieces.
https://soulmedicine.io
MIT License
38 stars 9 forks source link

Code split JavaScript for better web performance. #380

Closed tarebyte closed 9 months ago

tarebyte commented 1 year ago

While running locally and deploying we get the following warning:

remote:        WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
remote:        This can impact web performance.
remote:        Assets:
remote:          js/877-f4a664ae73896a4f6252.js (876 KiB)
remote:          js/877-f4a664ae73896a4f6252.js.gz (261 KiB)
remote:          js/877-f4a664ae73896a4f6252.js.map.gz (931 KiB)
remote:          js/877-f4a664ae73896a4f6252.js.map.br (783 KiB)
remote:
remote:        WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
remote:        Entrypoints:
remote:          application (1.07 MiB)
remote:              js/runtime-547b132100ce15a7b64c.js
remote:              css/877-639f880b.css
remote:              js/877-f4a664ae73896a4f6252.js
remote:              css/application-0fec8172.css
remote:              js/application-14d7092f7504bd01929f.js
remote:
remote:        WARNING in webpack performance recommendations:
remote:        You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
remote:        For more info visit https://webpack.js.org/guides/code-splitting/
remote:
remote:        webpack 5.88.2 compiled with 5 warnings in 27358 ms

This PR introduces Webpack code splitting which will reduce the footprint of each *.js file. So instead of one application.js file we'll have three files rails, bootstrap, and application.

tarebyte commented 12 months ago

Deployed to staging, looks like that didn't quite fix it.

remote:        WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
remote:        This can impact web performance.
remote:        Assets:
remote:          js/13-5c704d0ba9a86e1a45eb.js (601 KiB)
remote:          js/13-5c704d0ba9a86e1a45eb.js.map.gz (623 KiB)
remote:          js/13-5c704d0ba9a86e1a45eb.js.map.br (523 KiB)
remote:
remote:        WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
remote:        Entrypoints:
remote:          application (946 KiB)
remote:              js/runtime-547b132100ce15a7b64c.js
remote:              js/755-f74dce56a5ed1d719e15.js
remote:              js/918-c84c2164d5778b49bb04.js
remote:              css/13-d599193f.css
remote:              js/13-5c704d0ba9a86e1a45eb.js
remote:              css/application-0fec8172.css
remote:              js/application-a754fae9f3776e876e6f.js