Last active
May 29, 2017 09:12
-
-
Save far-blue/1db4205adf1cbf18f732a6f2cf2e8b7e to your computer and use it in GitHub Desktop.
a concept for multiple bundles with sfx-core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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