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

perf: defer application main JS chunks #3619

Merged
merged 2 commits into from
Oct 8, 2024
Merged

Conversation

ragafus
Copy link
Contributor

@ragafus ragafus commented Oct 3, 2024

Description

The goal of this PR is to avoid network falls when downloading MC apps initial JS chunks (runtime and app bundles.See screenshots below).
By moving initial JS chunks to the HTML head and deferring them, we allow the browser to concurrently download the initial JS chunks and the initial CSS files.
We save ~60ms when cold loading a MC app.

You can use https://github.com/commercetools/merchant-center-frontend/pull/17738 to test the Webpack changes (I've patched @commercetools-frontend/mc-html-template in that branch of the monorepo).

Current Discount app

https://mc.europe-west1.gcp.escemo.com/sunrise-data-alex/discounts

Screenshot 2024-10-03 at 15 17 56

DIscount app with this PR changes

https://mc-17738.mc-preview.europe-west1.gcp.escemo.com/sunrise-data-alex/discounts

Screenshot 2024-10-04 at 11 40 52

@ragafus ragafus self-assigned this Oct 3, 2024
Copy link

changeset-bot bot commented Oct 3, 2024

🦋 Changeset detected

Latest commit: 8ec2c9e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@commercetools-frontend/mc-html-template Patch
@commercetools-frontend/mc-scripts Patch
@commercetools-applications/merchant-center-template-starter-typescript Patch
@commercetools-applications/merchant-center-template-starter Patch
@commercetools-applications/merchant-center-custom-view-template-starter-typescript Patch
@commercetools-applications/merchant-center-custom-view-template-starter Patch
@commercetools-local/playground Patch
@commercetools-backend/eslint-config-node Patch
@commercetools-backend/express Patch
@commercetools-backend/loggers Patch
@commercetools-frontend/actions-global Patch
@commercetools-frontend/application-components Patch
@commercetools-frontend/application-config Patch
@commercetools-frontend/application-shell-connectors Patch
@commercetools-frontend/application-shell Patch
@commercetools-frontend/assets Patch
@commercetools-frontend/babel-preset-mc-app Patch
@commercetools-frontend/browser-history Patch
@commercetools-frontend/codemod Patch
@commercetools-frontend/constants Patch
@commercetools-frontend/create-mc-app Patch
@commercetools-frontend/cypress Patch
@commercetools-frontend/eslint-config-mc-app Patch
@commercetools-frontend/i18n Patch
@commercetools-frontend/jest-preset-mc-app Patch
@commercetools-frontend/jest-stylelint-runner Patch
@commercetools-frontend/l10n Patch
@commercetools-frontend/mc-dev-authentication Patch
@commercetools-frontend/notifications Patch
@commercetools-frontend/permissions Patch
@commercetools-frontend/react-notifications Patch
@commercetools-frontend/sdk Patch
@commercetools-frontend/sentry Patch
@commercetools-frontend/url-utils Patch
@commercetools-local/visual-testing-app Patch
@commercetools-website/components-playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mc-app-kit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 3:27pm
merchant-center-application-kit-components-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 3:27pm

@ragafus ragafus marked this pull request as ready for review October 4, 2024 10:50
@ragafus ragafus requested a review from a team as a code owner October 4, 2024 10:50
@ragafus ragafus changed the title perf: defer main application JS chunks perf: defer application main JS chunks Oct 4, 2024
Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

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

Great find, thanks again for the contribution! 🙌

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

Nice find. Thanks!

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.

3 participants