How can I reuse code from another bundle so I don't end up bundling that code again? For example:
One.js
import $ from './jQuery';
import Something from './Something';
Something.do($('.test'));
After Rollup: bundleOne.js
(function () {
var $ = function() { // ... }();
var Something = function() { // ... }();
Something.do($('.test'));
}());
Two.js
import $ from './jQuery';
$('.testTwo').addClass('test');
After Rollup: bundleTwo.js
(function () {
var $ = function() { // ... }();
$('.testTwo').addClass('test');
}());
index.html
<script type="text/javascript" src="bundleOne.js"></script>
<script type="text/javascript" src="bundleTwo.js"></script>
The above code causes Rollup to bundle jQuery twice. How can I access jQuery from bundleOne.js in bundleTwo.js and prevent Rollup from including jQuery in bundleTwo.js? There are multiple modules I'd like to reuse in the second bundle without including them again.