Component library with component that is composed of another does not render the base component
See original GitHub issueVersion
3.0.0-rc.10
Reproduction link
https://github.com/lukef/vue-component-repro
Steps to reproduce
I have included a project that will demonstrate the issue. Instructions in README.
What is expected?
<cool-component>
is derived from <base-component>
. My expectation is that when <cool-component>
is rendered that it should also render the base component as well. That isn’t happening.
What is actually happening?
What happens is that <cool-component>
is rendered but <base-component>
(in this case <BaseComponent>
) is not being rendered and is being translated to the literal tag <basecomponent>
(no hyphen).
The console contains the following warning: [Vue warn]: resolveComponent can only be used in render() or setup().
Not really sure what I’ve done wrong with setup or whether this is a bug.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Vue 3: Component library with component that is composed of ...
The problem is that when I use a <cool-component> component in a project, only the items inside the CoolComponent class are rendered. The ......
Read more >Vue 3: Component library with component that is composed of ...
Coding example for the question Vue 3: Component library with component that is composed of another does not render the base component-Vue.js.
Read more >Composition vs Inheritance - React
Composition vs Inheritance ... React has a powerful composition model, and we recommend using composition instead of inheritance to reuse code between components....
Read more >Building a React Component Library — The Right Way
Build a modular library with independently published reusable components using React, TypeScipt, Webpack, Jest, MDX. Scalable, maintainable ...
Read more >Build a component library with React and TypeScript
js or Create React App, we have to start from scratch. To build this UI library, we'll be using the following tools: TypeScript....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I still don’t see a solution to the issue in that other issue that resolves this one so I’m not really sure it is closed. I tried modifying the webpack config in my
vue.config.js
file to include:vue$: path.resolve("./node_modules/vue/dist/vue.runtime.esm.js")
But this create a myriad of other issues if you’re using vuex, vue-router, etc in the consuming project.
It shouldn’t be this hard to make a component library for vue.
I’m having the same issue that @lukef in my library https://github.com/alvarosaburido/vue-dynamic-forms. If I use it on a typescript vue3 app like the. one in
dev/typescript
it works, but in a javascript onedev/vue
, it doesn’tThe console also output the following warnings:
[Vue warn]: resolveComponent can only be used in render() or setup().
[Vue warn]: Invalid VNode type: Symbol(Fragment) (symbol) at <AsDynamicForm form= {id: "example-form", fields: Array(4)} onSubmited=fn<handleSubmit> onChanged=fn<valueChanged> ... > at <App>
@posva Is there a workaround that doesn’t require changing to rollup?