These are chat archives for systemjs/systemjs

10th
Aug 2016
Guillaume DROUET
@gdrouet
Aug 10 2016 09:03
Hi, do you consider that's a good approach to work during development with a dynamic resource resolution, which allows to skip any bundling operation each time you make some changes and then to bundle the statics before going to production? In that scenario how you would update easily the systemjs config to rely on the bundle once you're in production only? Is assetgraph-systemjs the recommended approach? Tks @guybedford
Peter Müller
@Munter
Aug 10 2016 09:46
@gdrouet I development you would keep doing the dynamic loading as you probably already do. Assetgraph is wrapping systemjs-builder, then doing some extra bundling. You do not need to make any change to your system.config at all, since the bundle will just inject all the dependencies into the systemjs cache before the execution of the main app starts
Guillaume DROUET
@gdrouet
Aug 10 2016 09:50
Clear, thank you
Peter Müller
@Munter
Aug 10 2016 09:53
Now, I haven't had a chance to run the assetgraph-systemjs integration in an app of my own yet, but assetgraph further bundles things after the systemjs builder call, which means that it will most likely replace your script tags of polyfills, systemjs, systemjs-config and app-init down to a single bundle.
Guillaume DROUET
@gdrouet
Aug 10 2016 10:32
@Munter this is quite strange, I created a bundle for my application with systemjs-builder based on my working systemjs config, included this script in my HTML page and when I load my page it randomly works, some time everything is fine and my statics are not loaded individually (the bundle content is used instead) but some times I get an error => EXCEPTION: Error during instantiation of AnimationDriver! (ViewUtils -> RootRenderer -> DomRootRenderer -> AnimationDriver).
Peter Müller
@Munter
Aug 10 2016 10:33
What is the order of your script includes and are any of them async?
Guillaume DROUET
@gdrouet
Aug 10 2016 10:34
1) angular2-polyfills.js 2) systemjs 3) bundle 4) init script with systemjs config and bootstrap import
I did not declared any explicit async loading
Peter Müller
@Munter
Aug 10 2016 10:43
Sounds like there might be a missing dependency annotation somewhere and you are now hitting it because the timing of loading bundled content is different from dynamic loading
Guillaume DROUET
@gdrouet
Aug 10 2016 10:44
tks I'm going to check, le you know
Peter Müller
@Munter
Aug 10 2016 10:44
So you might have been dependent on some global leak that forces a specific load order
I'm just guessing here, since I don't have access. But this is exactly what we saw when we started converting a badly modularised code base
Guillaume DROUET
@gdrouet
Aug 10 2016 11:36
Well I just debugged my stacktrace and it just an attempt to read document.body that failed because it was null, probably meaning that some times the script is executed before the body is loaded in the DOM. I declared my scripts after the <body> element and this solved the issue
Peter Müller
@Munter
Aug 10 2016 12:28
Yes. While you were dynamically loading there was enough delay for this to work, but now things are evaluated a lot faster, so you run into this. Either do what you just did, move it below body, or make sure you delay those critical lines of code until the domReady event has fired. If you do that you can also use async loading of your javascript, clearing up some load blocking for the remaining assets on the page at the same time
Guillaume DROUET
@gdrouet
Aug 10 2016 12:32
I see
Thank Peter :)
Hürkan Yakay
@hurkanyakay
Aug 10 2016 15:06
hi:) Who is responsible for getting content of Angular2 templateUrl(xhr request) : Zone.js or System.Js ??? i wrote a System.js plugin for .html files but it isn't triggering :( Maybe here is not the place but I hope someone know something
Peter Müller
@Munter
Aug 10 2016 18:42
@gdrouet in development