File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,22 @@ Vue.use(VueRouter)
55
66const 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
1519const Foo = resolve => require ( [ './Foo.vue' ] , m => resolve ( m . default ) )
1620const 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// })
You can’t perform that action at this time.
0 commit comments