This repository has been archived by the owner on Jan 22, 2020. It is now read-only.
replace full lodash inlined into client with lodash/assign #176
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.
This replaces the full build of lodash in the client library with only the
assign
method that the library requires. It reduces bundle size considerably.I'm using the react-engine client library in a project, and I found that Webpack was producing very large builds, even though in my own code I had very few dependencies.
The culprit appeared to be lodash:
In my own code, I was only using small slivers of lodash, based on the recommendation from the examples at lodash.com:
But the analyzer said it was coming from the whole library. After some research, I discovered that the client library uses lodash.assign by calling
require('lodash').assign
instead ofrequire('lodash/assign')
. When I made that change in my own react-engine branch, here was the resulting build:This one-line change results in a huge reduction in bundle size! 500KB before minification, and 66KB after.