I would like to learn what is the best way to organize the JS code.
In my application have jQuery dependency and have some plugins that I use in specific pages, like:
Page 1 needs:
- jquery
- magnific-popup
- autosize
- owl.carousel
Page 2 needs:
- jquery
- magnific-popup
- autosize
- photoswipe
- verlok
- tinyColorPicker
- ZebraDatePicker
- rangeslider
- dropzonejs
Page 3 needs:
- jquery
- magnific-popup
- verlok
Is preferable to do a mega bundle with all dependency and load that in all pages.
or
Import jQuery in all pages and create a specific bundle for each page?
or
Include jQuery in specific bundle for each page and load one just file for each page?