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

Performance: Reduce the initial js bundle size #819

Merged
merged 1 commit into from
Jan 8, 2023

Conversation

vmarseguerra
Copy link
Contributor

By making use of react code splitting and removing barely used heavy libraries

Also adds a loader while the application is loading (#445)

Current size 4.5Mo
Major changes:

  • lodash: 110Ko (removed)
  • jwt: 460ko (removed)
  • lang: 803ko (loaded dynamicly)
  • swagger-ui: 1Mo (splitted)
  • D3.js + hexbin: 330Ko (splitted)
  • date-fns: 100Ko (splitted)
  • proj4: 85Ko (splitted)
  • leaflet-draw 70Ko (splitted)

New initial bundle size 1.68Mo

Each locale strings are now loaded dynamically when the user switch. For performance the fetching of the initial locale strings starts directly from the html page.

All the locale strings file have been moved to the public folder, is there also configurations to change for the transifex bot ?

To analyse the bundle I use the following commands:

yarn build
npx source-map-explorer packages/web-app/build/static/js/*.js

Current bundle + New bundle + Loader preview:
preview.zip

@github-actions
Copy link

github-actions bot commented Jan 1, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://orange-rock-0d4f87503-819.westeurope.azurestaticapps.net

Copy link
Contributor

@urien urien left a comment

Choose a reason for hiding this comment

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

C'est super, le temps de chargement est beaucoup plus court et l'image d'attente est très sympa et permettra de faire comprendre aux utilisateurs avec une connexion limité que des choses sont en cours de chargement
Merci !

@Clm-Roig
Copy link
Member

Clm-Roig commented Jan 1, 2023

All the locale strings file have been moved to the public folder, is there also configurations to change for the transifex bot ?

Yes there is something to change ! I can handle this part when the PR is merged.

I will review your code later, thank you very much for your work.

packages/web-app/public/index.html Show resolved Hide resolved
packages/web-app/public/index.html Show resolved Hide resolved
packages/web-app/src/actions/Intl.js Outdated Show resolved Hide resolved
packages/web-app/src/pages/Application.jsx Outdated Show resolved Hide resolved
packages/web-app/src/reducers/IntlReducer.js Outdated Show resolved Hide resolved
packages/web-app/src/reducers/LoginReducer.js Outdated Show resolved Hide resolved
@vmarseguerra vmarseguerra force-pushed the reduce-js-initial-bundle-size branch from 0764df3 to 1d9a567 Compare January 2, 2023 12:38
@github-actions
Copy link

github-actions bot commented Jan 2, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://orange-rock-0d4f87503-819.westeurope.azurestaticapps.net

@vmarseguerra vmarseguerra force-pushed the reduce-js-initial-bundle-size branch from 1d9a567 to ee87359 Compare January 2, 2023 13:24
@github-actions
Copy link

github-actions bot commented Jan 2, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://orange-rock-0d4f87503-819.westeurope.azurestaticapps.net

@vmarseguerra vmarseguerra force-pushed the reduce-js-initial-bundle-size branch from ee87359 to 39e63f2 Compare January 4, 2023 20:37
@github-actions
Copy link

github-actions bot commented Jan 4, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://orange-rock-0d4f87503-819.westeurope.azurestaticapps.net

@vmarseguerra vmarseguerra requested a review from Clm-Roig January 6, 2023 13:06
@urien urien requested a review from bsoufflet January 6, 2023 16:16
@vmarseguerra vmarseguerra force-pushed the reduce-js-initial-bundle-size branch from 39e63f2 to 7d40b66 Compare January 8, 2023 14:02
@github-actions
Copy link

github-actions bot commented Jan 8, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://orange-rock-0d4f87503-819.westeurope.azurestaticapps.net

@urien urien merged commit e898bab into develop Jan 8, 2023
@urien urien deleted the reduce-js-initial-bundle-size branch January 8, 2023 16:51
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.

4 participants