Globals
Ƭ File: string | { content: string ; extname: string }
Defined in index.ts:75
Represents the content of the file or the content and the extension name.
• Const
version: string = process.env.VERSION
Defined in index.ts:278
the version of the library (process.env.VERSION is set by webpack, at compile-time)
▸ loadModule(path
: string, options?
: Options): Promise<Module>
Defined in index.ts:750
This is the main function.
Name | Type | Default value | Description |
---|---|---|---|
path |
string | - | The path of the .vue file. If path is not a path (eg. an string ID), your getFile function must return a File object. |
options |
Options | throwNotDefined('options') | The options |
Returns: Promise<Module>
A Promise of the component
example using Vue.defineAsyncComponent
:
const app = Vue.createApp({
components: {
'my-component': Vue.defineAsyncComponent( () => loadModule('./myComponent.vue', options) )
},
template: '<my-component></my-component>'
});
example using await
:
;(async () => {
const app = Vue.createApp({
components: {
'my-component': await loadModule('./myComponent.vue', options)
},
template: '<my-component></my-component>'
});
})()
.catch(ex => console.error(ex));