Ember-cli-lazy-load
Ember Cli Lazy Load supports lazily loading your Ember application, by splitting the app up into bundles. It comes with a dummy app that implements a basic lazy loading scenario.
Requirements: ember-cli
>= 2.3.0
For ember-cli
== 2.2.0, use release 0.2.2
.
Whenever ember-engines land their version of lazy loading, this add-on will be deprecated.
Installation
ember install ember-cli-lazy-load
Getting started
config/bundles.js
1. Configure your bundles in index: //Minisearch file patterns for the content of the bundle files: "**/templates/index.js" "**/controllers/index.js" "**/components/my-cat/**.js" //The name of the routes if you are using the lazy-route mixin, no minisearch expressions are allowed here. routes: "index" "..." //The dependencies for this bundle. They will loaded in the same batch as the actual bundle dependencies: "about"about: files: "**/templates/about.js" "**/controllers/about.js" "**/components/my-item/**.js" routes: "about" "more routes for this bundle "
config/environment.js
to include the bundle files
2. Modify var bundles = ;module { var ENV = bundles:
ember-cli-build.js
to use the custom bundle build flow.
3. Modify your var EmberApp = ;var bundles = ; module { var app = defaults // Add options here bundles: bundles
4. Add Mixin to your routes
;; Route;
if you already override beforeModel
, ensure that you execute and await the super call:
;; Route;
Running
ember server
- Visit your app at http://localhost:4200.
Running Tests
npm test
(Runsember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server