Skip to content

Instantly share code, notes, and snippets.

@far-blue
Last active May 29, 2017 09:12
Show Gist options
  • Save far-blue/1db4205adf1cbf18f732a6f2cf2e8b7e to your computer and use it in GitHub Desktop.
Save far-blue/1db4205adf1cbf18f732a6f2cf2e8b7e to your computer and use it in GitHub Desktop.
a concept for multiple bundles with sfx-core
/*
In order to load multiple bundles with sfx-core, how about wrapping each non-sfx bundling in the following:
*/
if (!window.hasOwnProperty('$_declares')) {
window.$_declares = [];
}
window.$_declares.push(function (System) {
// ** original bundle content here **
});
/*
Then, where sfx-core would usually wrap the bundle, instead replace with:
*/
window.$_declares.forEach(function (declaredModule) { declaredModule(System); }, this);
/*
Load all the bundles first and then load sfx-core with the above content.
It might also be good to track the 'firstLoad' module name so it can be dynamically setup rather than included in sfx-core.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment