Skip to content

feat(rule): Forbid importing directly from main module#46

Merged
billyvg merged 2 commits intomasterfrom
feat/rule/forbid-default-lodash-import
Nov 12, 2019
Merged

feat(rule): Forbid importing directly from main module#46
billyvg merged 2 commits intomasterfrom
feat/rule/forbid-default-lodash-import

Conversation

@billyvg
Copy link
Member

@billyvg billyvg commented Nov 11, 2019

Instead, import the specific module. e.g. import isEqual from 'lodash/isEqual'

Instead, import the specific module. e.g.
@billyvg billyvg requested a review from a team November 11, 2019 23:47
@billyvg
Copy link
Member Author

billyvg commented Nov 11, 2019

See getsentry/sentry#15521

Copy link
Member

@dashed dashed left a comment

Choose a reason for hiding this comment

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

needs some 🎄shaking

@billyvg billyvg merged commit 1ab0924 into master Nov 12, 2019
@billyvg billyvg deleted the feat/rule/forbid-default-lodash-import branch November 12, 2019 23:00
billyvg added a commit to getsentry/sentry that referenced this pull request Nov 13, 2019
Undoes the work introduced in #5616. 

This plugin adds around 40-50 seconds to webpack build times and has caused confusion (see #13834).

Also adds an eslint rule to prevent importing `lodash` bundle: getsentry/eslint-config-sentry#46

| -- | With Plugin | Without Plugin | Difference | lodash-es | lodash-es + react-mentions |
| -- | ----------- | -------------- | ---------- | --------- | - |
| app.js | 739051 | 739120 | 0% | | |
| app.js.gzip | 184017 | 184040 | 0% | | 186949 |
| vendor.js | 2076311 | 2090876 | +0.7% | 2089352 |
| vendor.js.gizp | 375718 | 380446 | + 1.2% | 380630 | 380476 |
| build time (w/ stats) | 316s | 466s | + 47% | |
| build time (env=prod) | 335s | 198s | n/a | |

Currently, there is no sizable difference between `lodash-es` and `lodash` -- we should revisit this in the future.
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.

2 participants