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

Comments

@nikku
Copy link
Member

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 label Jul 30, 2018

philippfromme added a commit that referenced this issue Jul 31, 2018
chore(project): migrate from lodash to min-dash
* migrate to min-dash
* implement flattenDeep and xor

Closes #2
Closes #3
philippfromme added a commit that referenced this issue Jul 31, 2018
chore(project): migrate from lodash to min-dash
* 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 and removed ready 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 in #4 Aug 1, 2018

nikku added a commit that referenced this issue Aug 1, 2018

@ghost ghost removed the needs review label Aug 1, 2018

nikku added a commit that referenced this issue Aug 1, 2018
chore(project): migrate from lodash to min-dash
* 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
Projects
None yet
2 participants
You can’t perform that action at this time.