[shared-ui-deps] use a single global version of lodash#78100
Merged
spalger merged 11 commits intoelastic:masterfrom Sep 24, 2020
Merged
[shared-ui-deps] use a single global version of lodash#78100spalger merged 11 commits intoelastic:masterfrom
spalger merged 11 commits intoelastic:masterfrom
Conversation
Contributor
Author
|
@elasticmachine merge upstream |
8fe3186 to
d3bc307
Compare
386d3a7 to
ffa149a
Compare
Contributor
|
Pinging @elastic/kibana-operations (Team:Operations) |
Contributor
💚 Build SucceededMetrics@kbn/optimizer bundle module count
async chunks size
page load bundle size
distributable file count
History
To update your PR or re-run it, just comment with: |
mistic
reviewed
Sep 24, 2020
| log, | ||
| })!; | ||
|
|
||
| const xpackDeps = resolveDepsForProject({ |
Contributor
There was a problem hiding this comment.
@spalger once we move into a single package.json that one could be removed 🤓
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that we have a unified lodash version thanks to #69868 we can share lodash from the ui-shared-deps without any functional issues. This reduces the page load asset size dramatically, and lowers all the other metrics too (a good thing).
This means that every bit of front-end code that imports lodash will be forced to use the shared version of lodash, currently
4.17.20.I don't expect this to last forever, or even for long. Lodash is one of those packages that is used so widely that maybe it's impractical to try and stop using it. lodash v5 is a possible issue that we may have to deal with sooner rather than later, but maybe we'll get lucky and be able to ship a single copy of lodash v4 forever.
To attempt to at least make it clear when we're slipping back I've implemented two checks in the kbn/pm bootstrap command. The first validates that there is only a single version of lodash v4 in the yarn.lock file. If multiple are detected then all will be removed from the file and an error will be printed instructing the user to re-bootstrap to trigger an update of all lodash versions.
The second check crawls through all the production dependencies (including transitive dependencies) of the kibana and x-pack projects as defined in the yarn.lock file. If there are any lodash v3 versions in the discovered dependencies an error will be logged instructing the user to either use a new dependency or to chat with the operations team about other options.