Import of 'lodash' leads to full lodash.js source in webpack build
fvsch opened this issue · comments
Hi there,
Bug report
- Package version(s): react-mosaic-component@5.3.0, react-mosaic-component@6.0.0
- Browser and OS versions: any
Steps to reproduce
Overall this library uses lodash
by importing specific modules likes this:
import isEmpty from 'lodash/isEmpty';
But there is one instance of:
import _ from 'lodash';
in src/util/OptionalBlueprint.tsx
which leads to webpack builds including the lodash/lodash.js
file from lodash, which is 60kB minified (before gzip).
See in this screenshot generated by webpack-bundle-analyzer
:
And the import stack as shown by @statoscope/webpack-plugin
:
These are from a private production app, but I can build a minimal reproduction if needed.
Note that there are similar issues when using Vite, so it's not webpack-specific.
The fix seems straigthforward, so I’ll submit a PR.
Actual behavior
JavaScript bundles importing react-mosaic-component
contain a copy of node_modules/lodash/lodash.js
.
Expected behavior
Importing react-mosaic-component
should not lead to node_modules/lodash/lodash.js
being included in bundled JavaScript.