Hello, I wrote and exported some components. Now i have the following problem if i install and import this components to another project.
No overload matches this call.
The last overload gave the following error.
Type 'PluginFunction<any>' is not assignable to type 'VueConstructor<Vue> | FunctionalComponentOptions<any, PropsDefinition<any>> | ComponentOptions<never, any, any, any, any, Record<...>> | AsyncComponentPromise<...> | AsyncComponentFactory<...>'.
Type 'PluginFunction<any>' is not assignable to type 'AsyncComponentPromise<any, any, any, any>'.
Types of parameters 'Vue' and 'resolve' are incompatible.
Type '(component: Component<any, any, any, any>) => void' is missing the following properties from type 'VueConstructor<Vue>': extend, nextTick, set, delete, and 10 more.
I export the components in my package ("@ simon.marcel.linden / ExampleComponents") in the index.ts under src / lib-components as follows
export { default as component1 } from '@/lib-components/component1/component1.vue';
export { default as component2 } from '@/lib-components/component2/component2.vue';
export { default as component3 } from '@/lib-components/component3/component3.vue';
And then I import them in another project
import { Component, Vue } from "vue-property-decorator";
import {component1} from "@simon.marcel.linden/ExampleComponents";
import {component2} from "@simon.marcel.linden/ExampleComponents";
@Component({
components: {
component1,
component2,
}
})
export default class AwesomePackage extends Vue {
}
Hi @jesus9ias
, I updated vue-sfc-rollup to the latest version and copied my components. Now it seems to be working. It's strange. I haven't changed anything in my code.
Currently, I am importing the components all individually as shown in my example above. If I want to import everything at once, I do this as follows:
Hey @jesus9ias
any idea how i can use scss-files global for all components of my Library? I try to import my global files into entry.esm.ts but when I build my library my components used allways scoped styles but no global.
hi @wobsoriano
, I didn't make a test with composition api plugin, I think it's possible with properly extra configurations, but may be for other post.
Hello, I wrote and exported some components. Now i have the following problem if i install and import this components to another project.
Hi @simonmarcellinden , what Vue version are you using in the components and project? I think it's a version problem.
Hello @jesus9ias I am currently using Vue version 2.6.12 and the following versions of Typescript and co
That's looks ok, how are you importing and setting the components? I see there is a type mismatch in the error
I export the components in my package ("@ simon.marcel.linden / ExampleComponents") in the index.ts under src / lib-components as follows
And then I import them in another project
Hi @jesus9ias , I updated vue-sfc-rollup to the latest version and copied my components. Now it seems to be working. It's strange. I haven't changed anything in my code.
Currently, I am importing the components all individually as shown in my example above. If I want to import everything at once, I do this as follows:
I then get the following error
Syntax Error: Error: No ESLint configuration found in 'packagename/dist'Any idea how I can fix this?
Hey @jesus9ias any idea how i can use scss-files global for all components of my Library? I try to import my global files into entry.esm.ts but when I build my library my components used allways scoped styles but no global.
Thanks!
Can you publish a Vue 2 component with Composition API plugin instead?
hi @wobsoriano , I didn't make a test with composition api plugin, I think it's possible with properly extra configurations, but may be for other post.
Thanks! I'll try and let you know
Great article, but is the exported components tree-shakable?
Hi @jaslioin , yes, it is tree-shakable thanks to rollup