From c383fd213a27775f4db51c81e80b3201e05c88eb Mon Sep 17 00:00:00 2001 From: Daniel Diekmeier Date: Wed, 22 Feb 2017 16:19:05 +0100 Subject: [PATCH] Add short example for async local registration --- src/v2/guide/components.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/v2/guide/components.md b/src/v2/guide/components.md index a2c8028938..2758183341 100644 --- a/src/v2/guide/components.md +++ b/src/v2/guide/components.md @@ -1020,6 +1020,17 @@ Vue.component( ) ``` +When using [local registration](https://vuejs.org/v2/guide/components.html#Local-Registration), you can also directly provide a function that returns a `Promise`: + +``` js +new Vue({ + // ... + components: { + 'my-component': () => import('./my-async-component') + } +}) +``` +

If you're a Browserify 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.

### Component Naming Conventions