Open timlrx opened 3 years ago
react-icons
contribute to large size of bundle, might need to look for alternatives such as @material-ui/icons
or reuse ant design's icon as we already have @ant-design/icons
imported.
Name | Unpacked Size |
---|---|
react-icons | 36.5 MB |
@material-ui/icons | 10.2MB |
@ant-design/icons | 13.7MB |
Hmm, strange that your bundle is quite different from mine. react-icons should have tree-shaking such that only the required icons are imported and not everything. Might want to take a look to see if there's any stray import *
around
Hmm, strange that your bundle is quite different from mine. react-icons should have tree-shaking such that only the required icons are imported and not everything. Might want to take a look to see if there's any stray
import *
around
Did not find any stray with import *
in the entire codebase. I analyse the bundle size with npm run build
and npm run analyze
, not sure we are using the same way to analyse the bundle.
Yes, I re-run it and get the same as my first post. Might be leftovers from the previous builds? Can you try deleting the old dist and re-building?
Removed the old dist/
, perform rebuild and run bundle analyser, it still the same.
Removed the old
dist/
, perform rebuild and run bundle analyser, it still the same.
Remove node_modules
and rebuild with npm install
solve the problems. At the same time, I wrongly upload the screenshot from port 8888
and caused misunderstanding.
The bundle is more than 0.5MB - yikes!
G6 and the other Antv packages are more than 60%. I believe lodash is because of a graphin import: https://github.com/antvis/Graphin/blob/master/packages/graphin/src/controller/layout/dataChecker.ts#L2
The full G6 bundle is also due to how Graphin is importing the full G6 library instead of the necessary components.
Let's see if Graphin 2.0 reduces the bloat