Skip to content

Commit 9d7aaf9

Browse files
danieldiekmeierchrisvfritz
authored andcommitted
Add short example for async local registration (vuejs#778)
1 parent 146fdfc commit 9d7aaf9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/v2/guide/components.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,17 @@ Vue.component(
10201020
)
10211021
```
10221022

1023+
When using [local registration](https://vuejs.org/v2/guide/components.html#Local-Registration), you can also directly provide a function that returns a `Promise`:
1024+
1025+
``` js
1026+
new Vue({
1027+
// ...
1028+
components: {
1029+
'my-component': () => import('./my-async-component')
1030+
}
1031+
})
1032+
```
1033+
10231034
<p class="tip">If you're a <strong>Browserify</strong> user that would like to use async components, its creator has unfortunately [made it clear](https://github.com/substack/node-browserify/issues/58#issuecomment-21978224) that async loading "is not something that Browserify will ever support." Officially, at least. The Browserify community has found [some workarounds](https://github.com/vuejs/vuejs.org/issues/620), which may be helpful for existing and complex applications. For all other scenarios, we recommend simply using Webpack for built-in, first-class async support.</p>
10241035

10251036
### Component Naming Conventions

0 commit comments

Comments
 (0)