-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[shared-ui-deps] use a single global version of lodash #78100
Conversation
@elasticmachine merge upstream |
8fe3186
to
d3bc307
Compare
386d3a7
to
ffa149a
Compare
Pinging @elastic/kibana-operations (Team:Operations) |
💚 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: |
log, | ||
})!; | ||
|
||
const xpackDeps = resolveDepsForProject({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spalger once we move into a single package.json that one could be removed 🤓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That LGTM
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.