Import only lodash submodules
yurishkuro opened this issue · 3 comments
yurishkuro commented
In order to reduce the bundle size, lodash recommends importing submodules, e.g. import _get from 'lodash/get'
instead of import { debounce } from 'lodash'
. Most of our code is already like that, with the exception of just a handful of files:
$ grx lodash packages/*/src | grep -v 'lodash/'
packages/jaeger-ui/src/components/DependencyGraph/DependencyForceGraph.jsx:18:import { debounce } from 'lodash';
packages/jaeger-ui/src/components/TracePage/TraceStatistics/tableValues.tsx:16:import * as _ from 'lodash';
packages/jaeger-ui/src/components/TracePage/TraceStatistics/generateDropdownValue.tsx:15:import _ from 'lodash';
packages/jaeger-ui/src/components/SearchTracePage/SearchResults/ResultItem.tsx:20:import { sortBy } from 'lodash';
This ticket is to clean up these remaining full imports by replacing them with the needed submodule imports.
It will be interesting to see how much it would affect the bundle size:
professorabhay commented
Hey, @yurishkuro! I would like to work on this.
anshgoyalevil commented
Can you please tell how did you generated this bundle size visualization.
yurishkuro commented
It's auto generated by our build, stats.html