I'm trying to generate a second webpack bundle that's dependent on another bundle. Every page needs bundle-one, but only some pages need bundle-two.
For instance, let's say I have the following entry point scripts (these are trivial examples, just using them to get the point across):
bundle-one.js
import $ from 'jquery';
$(document).data('key', 'value');
bundle-two.js
import $ from 'jquery';
const value = $(document).data('key');
I know that I can use CommonsChunkPlugin to generate a commons.js file containing the WebPack loader and jQuery, but that would require loading both commons.js and bundle-one.js on every page, even when I don't need to load bundle-two.js.
So, basically: is there a way to build bundle-one.js as the "main" JavaScript bundle for all my pages, and then have bundle-two.js setup to load jQuery from bundle-one.js?