Skip to content

Commit 2cf1fa2

Browse files
committed
update lazy loading example comments
1 parent d6b3b97 commit 2cf1fa2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

examples/lazy-loading/app.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ Vue.use(VueRouter)
55

66
const Home = { template: '<div>home</div>' }
77

8-
// define Foo & Bar as async components
8+
// define Foo & Bar as async components.
9+
// async components are defined as: resolve => { resolve(Component) }
910

10-
// signature for async components: resolve => resolve(Component)
11-
// In Webpack we can use the AMD require syntax to "split" the bundle
11+
// In Webpack we can use the AMD require syntax to signify a "split point"
1212
// Webpack will automatically split and lazy-load the split modules.
13-
// https://webpack.github.io/docs/code-splitting.html
13+
// - https://webpack.github.io/docs/code-splitting.html
14+
15+
// Note we have to access `m.default` here because when loading a
16+
// module asynchronously, we get the entire ES2015 module instead of
17+
// just its default export.
1418

1519
const Foo = resolve => require(['./Foo.vue'], m => resolve(m.default))
1620
const Bar = resolve => require(['./Bar.vue'], m => resolve(m.default))
1721

18-
// NOTE if using Webpack 2, you should do:
22+
// If using Webpack 2, you can also do:
23+
1924
// const Foo = resolve => {
2025
// System.import('./Foo.vue').then(m => resolve(m.default)
2126
// })

0 commit comments

Comments
 (0)