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

#4514: Dynamically import Swiper to reduce client bundle size #4515

Merged
merged 1 commit into from Aug 14, 2018

Conversation

dancastellon
Copy link
Contributor

@dancastellon dancastellon commented Aug 7, 2018

Resolves #4514
Impact: minor
Type: performance

Issue

The Swiper NPM module (126 kb) is included in the initial client bundle. It's only used in one place - the cart drawer.

Solution

Move the loading of the module to a dynamic import.

Breaking changes

None.

Testing

  1. Add items to cart
  2. Confirm swiper still works (you can drag the items left/right while cart is expanded)
  3. Confirm swiper is no longer in bundle. Run Reaction with export TOOL_NODE_FLAGS='--max-old-space-size=4096' && METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor run --production --extra-packages bundle-visualizer

Before

swiper-before

After

swiper-after

@zenweasel
Copy link
Collaborator

2018-08-08_06-41-17

Copy link
Collaborator

@zenweasel zenweasel left a comment

Choose a reason for hiding this comment

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

Tested. Works well. 👍

@aldeed aldeed merged commit 06b71e5 into release-1.15.0 Aug 14, 2018
@aldeed aldeed deleted the perf-4514-dancastellon-swiper-dynamic-import branch August 14, 2018 21:00
@spencern spencern mentioned this pull request Aug 22, 2018
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.

None yet

3 participants