Would multiple SPFx webparts on page load duplicate dependencies?
-
08-12-2020 - |
Question
If I have an SPFx webpart and that webpart uses these dependencies:
- jQuery
- jQueryUI
- Angular
- LoDash
Then I have another SPFx webpart and that one uses:
- jQuery
- jQueryUI
- React
- Moment
If I load both those webparts on my page, I would be loading two bundles on the page. But both bundles have jQuery
and jQueryUI
. Is that not inefficient and could it cause conflicts?
I assume it's not going to cause a conflict but I'm concerned about loading duplicate libraries in terms of network consumption. I understand it's minified and likely cached through a CDN but still, not very DRY.
Solution
Right - you don't want to make those libraries bundled internally. You want them to be referenced externally.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange