I have a problem when importing with defineAsyncComponent and using render function
Here is parent template
<template>
<div id="Widget"></div>
<button @click="addTest()">Add Test</button>
</template>
Here is test.vue
<template>
<button>Click Me ah la</button>
<p>
{{$t(`test`)}}
</p>
</template>
I use the following code to dynamically create component and render it into "Widget" element
const addTest = async () => {
const widget = await defineAsyncComponent(() =>
import(`./test.vue`)
);
const node = h(widget);
const el = document.getElementById("Widget");
render(node, el);
}
I get the error
Uncaught (in promise) TypeError: _ctx.$t is not a function",
$t works without dynamic import.
What am I missing?
I also got the following wranning
Extraneous non-props attributes (app, config, mixins, components, directives, provides, optionsCache, propsCache, emitsCache, filters, reload) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.