I started developing a theme for Magento 2.2.0 and now I have to use some external javascript libraries both in my theme and my modules.
So what is the best solution to prevent loading the same library twice?
Should I create a new Module containing my javascript libraries and refernce them in my other modules?
EDIT:
For example I have a Module which requires a specific library like swiper.js.
So I would require it somehow with My_Module/path/to/swiper.js
.
But if I have another Module with the same dependency My_Module2/path/to/swiper.js
it now is loaded twice?
In Magento2 I can require jquery
and any other core library from anywhere but the documentation says you shouldnt put js into mageroot/lib/web/js.
So what is the best solution to prevent loading the same library twice?
?