Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is importing specific components resulting in the whole library in the bundle?

I'm following the recommendation to import individual components from react-bootstrap, like so import Container from "react-bootstrap/Container";. I've verified the whole codebase and every single import is the same. Yet, when I analyze the bundle, it shows that react-bootstrap has been bundled in its entirety.

Any ideas what I could be missing?

like image 696
Peter Avatar asked Nov 07 '22 00:11

Peter


1 Answers

Upon further investigation, I found that react-bootstrap-dialog was importing the whole of react-bootstrap. If you're here because of this same issue, I suggest you open package-lock.json and search for any libraries that depend on the unshakeable library, that's the one you should potentially replace.

Note: Answer provided by OP

like image 94
2 revs, 2 users 80% Avatar answered Nov 12 '22 20:11

2 revs, 2 users 80%