These are chat archives for systemjs/systemjs

6th
Oct 2016
con-ssc
@con-ssc
Oct 06 2016 07:58
do I always have to have an inital .import
Tolis Christomanos
@chchrist
Oct 06 2016 11:46
very difficult to understand this builder.bundle('app/**/* - [app/**/*]', 'dependencies.js', { minify: true, sourceMaps: true });
the wiki says
The above means take the tree of app and all its dependencies, and subtract just the modules in app, thus leaving us with just the tree of dependencies of the app package.
subtract just the modules in app
what does that mean?
isn’t everything a module?
how could I write the above using the API instead of arithmetic?
kjvelarde
@kjvelarde
Oct 06 2016 12:12
@chchrist it's an abstraction of the compiled result on runtime
Peter Müller
@Munter
Oct 06 2016 12:18
@chchrist That incantation is similar to taking your full dependency tree and subtracting each of the modules in your app folder individually, without their individual dependencies. You end up with a bundle of all the code that is not in your app folder
Tolis Christomanos
@chchrist
Oct 06 2016 12:19
ah, so is using the filenames to remove them from the array let’s say and then bundle?
hmmm
is this arithmetic way of doing things a standard or something systemjs specific?
Peter Müller
@Munter
Oct 06 2016 12:21
it's systemjsbuilder specific
But there is no reason why other dependency graph based tools shouldn't be able to implement the same
I thought avbout it for assetgraph. But we have a slightly different take on bundling, which exposes a higher level where you just choose between predefined bundling strategies
Common ones being one bundle per page, or shared bundles across pages
Tolis Christomanos
@chchrist
Oct 06 2016 12:24
I try to package only what is needed for each page
but I have third party as shared bundle
I’m trying to get the load times better.
I have a 5s blocking js on a nexus 6 at the moment with a single bundle
Peter Müller
@Munter
Oct 06 2016 12:55
ouch
How big is the bundle?
Tolis Christomanos
@chchrist
Oct 06 2016 13:09
~500KB
473KB
which we use only the 60KB for the homepage
Peter Müller
@Munter
Oct 06 2016 13:10
That's not even so bad. Javascript on mobile phones is just tough
oh, then you should certainly write a separate bundle for the front page
Tolis Christomanos
@chchrist
Oct 06 2016 13:11
yes but then I need to figure out where and when to use System.import to load the rest of the pages when needed
Peter Müller
@Munter
Oct 06 2016 13:11
Then you can make a bundle for the rest and put a preload link in your <head> to have it available when the user navigates
Tolis Christomanos
@chchrist
Oct 06 2016 13:11
is a single page app
with 50+ views in overlays
views/pages
I want to do something similar for systemjs
code splitting with routes
Peter Müller
@Munter
Oct 06 2016 13:17
Do you have a router implementation available that lets you hook into the navigation events?
Tolis Christomanos
@chchrist
Oct 06 2016 13:18
yes
Peter Müller
@Munter
Oct 06 2016 13:19
You basically need a mapping between route and entry point. Then you build a bundle per entry point. When a navigate event happens you do System.import(relevantBundle).then(continueNavigation)
Tolis Christomanos
@chchrist
Oct 06 2016 13:24
and I suppose I can cache each bundle individually
Peter Müller
@Munter
Oct 06 2016 13:47
Yes