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

Fix lodash ES module imports #2

Closed
nikku opened this issue Jul 30, 2018 · 0 comments
Closed

Fix lodash ES module imports #2

nikku opened this issue Jul 30, 2018 · 0 comments
Assignees

Comments

@nikku
Copy link
Member

nikku commented Jul 30, 2018

Bundling the library with browserify / babelify yields the following output:

[BABEL] Note: The code generator has deoptimised the styling of "{PROJECT_DIR}/node_modules/dmn-js-properties-panel/node_modules/lodash/lodash.js" as it exceeds the max of "500KB".

It hints us on the fact that the full distribution of lodash (> 500KB) is being packed into the properties panel.

To properly consume lodash so that ES module aware bundlers can tree-shake it we must not use destructuring syntax:

import { forEach, map } from 'lodash';

Instead, we must import individual utilities like this:

import forEach from 'lodash/forEach';
import map from 'lodash/map';

The alternative is to use lodash-es. However, that library variant has tree-shaking issues, too (as far as I am aware).

@nikku nikku added the ready Ready to be worked on label Jul 30, 2018
philippfromme added a commit that referenced this issue Jul 31, 2018
* migrate to min-dash
* implement flattenDeep and xor

Closes #2
Closes #3
philippfromme added a commit that referenced this issue Jul 31, 2018
* migrate to min-dash
* implement flattenDeep and xor

Closes #2
Closes #3
philippfromme added a commit that referenced this issue Aug 1, 2018
@ghost ghost added in progress Currently worked on and removed ready Ready to be worked on labels Aug 1, 2018
@philippfromme philippfromme added needs review Review pending and removed in progress Currently worked on labels Aug 1, 2018
@philippfromme philippfromme assigned nikku and unassigned philippfromme Aug 1, 2018
@ghost ghost assigned philippfromme Aug 1, 2018
@nikku nikku closed this as completed in #4 Aug 1, 2018
nikku pushed a commit that referenced this issue Aug 1, 2018
@ghost ghost removed the needs review Review pending label Aug 1, 2018
nikku pushed a commit that referenced this issue Aug 1, 2018
* migrate to min-dash
* implement flattenDeep and xor

Closes #2
Closes #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants