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)
5
5
6
6
const Home = { template : '<div>home</div>' }
7
7
8
- // define Foo & Bar as async components
8
+ // define Foo & Bar as async components.
9
+ // async components are defined as: resolve => { resolve(Component) }
9
10
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"
12
12
// 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.
14
18
15
19
const Foo = resolve => require ( [ './Foo.vue' ] , m => resolve ( m . default ) )
16
20
const Bar = resolve => require ( [ './Bar.vue' ] , m => resolve ( m . default ) )
17
21
18
- // NOTE if using Webpack 2, you should do:
22
+ // If using Webpack 2, you can also do:
23
+
19
24
// const Foo = resolve => {
20
25
// System.import('./Foo.vue').then(m => resolve(m.default)
21
26
// })
You can’t perform that action at this time.
0 commit comments