Async loading of routes


#1

Is it possible to dynamically load a route and its dependencies, perhaps just before the transition to the new route completes?

My initial searches brought up info related to slow loading models and a beforeModel method, but those seemed to imply the route module is already loaded and known to the resolver.

I can see where the full router.js needs to be loaded up front, but is there a way to delay the transition perhaps, such that the route module and its dependencies can be loaded before the transition goes on to completion? ember-cli#402 seems to talk about the issue, but seems a bit dated, so just checking in to see if there are new capabilities that might apply for the case now.

If the dynamic load of the route is possible, then I can see the next issue as effectively bundling up the route and its dependencies for the dynamic load. If there are hints on how dependencies are determined now for builds, they are also appreciated. I am still finding my way around the Ember’s sub-dependencies.

I am using Ember 2.4, can use 2.5 if that helps.


#2

What you are describing is known as engines in Ember. There’s an addon in progress here: https://github.com/dgeb/ember-engines