lazy load choo routes from split bundles
Last updated 3 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install choo-lazy-route 
SYNC missed versions from official npm registry.


var app = choo()
var splitRequire = require('split-require')
var lazyRoute = require('choo-lazy-route')()

app.route('/lazy-route', lazyRoute(function (cb) {
  splitRequire('./views/lazyView', cb)


lazyRoute = require('choo-lazy-route')()

Create an instance of the lazy route manager.


Associate the lazy route manager with an app. The lazyRoute store also configures the app to take advantage of the experimental prefetch feature in bankai, so that server side rendering will include lazy routes.

app.route('/', lazyRoute(function load() {}))

Create a lazy route. The load function can return a Promise or use the callback in its first parameter.


The lazy-route store emits the events listed below.


Emitted when a route starts loading. route is a string.

lazy-route:loaded(route, view)

Emitted when a route has loaded successfully. route is a string. view is the view function that was loaded.


  • timeout
  • loading view (show after 700ms or so)

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (5)
Dependents (0)

Copyright 2014 - 2017 © |