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

Import lodash-amd v4.71.11 #1298

Open
chrisknoll opened this issue Feb 5, 2019 · 0 comments · May be fixed by #1299
Open

Import lodash-amd v4.71.11 #1298

chrisknoll opened this issue Feb 5, 2019 · 0 comments · May be fixed by #1299

Comments

@chrisknoll
Copy link
Collaborator

Expected behavior

Bundling the lodash library should only incur the cost of the modules that are referenced, not an entire library.

Actual behavior

The lodash library imported via "lodash": "^4.17.11", in package.json leads to a very large bundle by importing the main lodash library (which is about 500k)

Steps to reproduce behavior

Disable cache and open your console and load the home page. You will get the lodash file downloaded:

image

Proposed Solution

There is a package for lodash combiled with AMD modules. In spite of what @ai believes, AMD support is still alive and kicking, and we can benefit from this library to only include dependencies that we actually require.

Changing package.json to have "lodash-amd": "^4.17.11", and updating the packages config to point to the new reference, we can use the specific lodash moduels via:

define(['lodash/chunk'],(chunk) -> { ... use chunk ... });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Review Complete
Development

Successfully merging a pull request may close this issue.

2 participants