Open pYr0x opened 6 years ago
This one might be a little tricky, we have multiple levels of side-effectual modules. I want to avoid preventing rollup from doing its dead code eliminate by having a blanket rule of keeping code when there are no side-effects just it is imported like import "foo";
but this might require that. Still investigating.
So, what's happening in this case is that the dependencies defined in cc/vendor
:
import "popper.js";
import "bootstrap/js/src/dropdown";
Get promoted to to cc/main
during tree-shaking:
/*cc@1.0.0#main*/
define('cc@1.0.0#main', [
'popper.js@1.14.3#dist/umd/popper',
'bootstrap@4.1.3#js/src/dropdown',
'jquery@3.3.1#dist/jquery',
'bootstrap@4.1.3#js/src/util'
], function () {
'use strict';
});
This is an internal decision to rollup, which we can't really control. Even if we could I'm not sure that we should, just for this use case. Promoting dependencies to parent modules is good in most situations as it means the removal of a module (cc/vendor
in this case).
Unfortunately this doesn't play well with the sideBundle
feature. So I'm not sure what to do about this. sideBundle
's sort of a weird feature, it lets you control how splitting works and that's not something steal-tools ever really did before.
the actual intention was to create a module that hardly ever changes. this code can be cached very well. any other ideas how to make this work?
see this demo app https://github.com/pYr0x/sidebundle
if treeshaking is off,
vendor
gets bundles out if true,vendor
is not bundled