简体   繁体   中英

issues with importing components from a library generated using vue-sfc-rollup

I created a component library using vue-sfc-rollup , however, I met a problem when using a component from it in another project. details are in the link below:

to add vue-lib component library I ran

npm install --save @knowscount/vue-lib

and then placed <InputBox /> & import InputBox from '@knowscount/vue-lib , registering the component, yet the page went blank and the folioing error was reported in the console:

[Vue warn]: Error in render: "TypeError: Vue.component is not a function"

found in

---> <App> at src/App.vue
       <Root>
warn @ vue.runtime.esm.js?2b0e:619

and also

vue.runtime.esm.js?2b0e:1888 TypeError: Vue.component is not a function
    at eval (vue-lib.esm.js?ca34:5655)
    at Array.forEach (<anonymous>)
    at installVueLib (vue-lib.esm.js?ca34:5654)
    at resolveAsyncComponent (vue.runtime.esm.js?2b0e:3686)
    at createComponent (vue.runtime.esm.js?2b0e:3200)
    at _createElement (vue.runtime.esm.js?2b0e:3422)
    at createElement (vue.runtime.esm.js?2b0e:3353)
    at vm._c (vue.runtime.esm.js?2b0e:3491)
    at Proxy.render (App.vue?6ad7:13)
    at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548)
logError @ vue.runtime.esm.js?2b0e:1888

everything is open-sourced here . comment if you would like my configuration stuff posted here.

I created a component library using vue-sfc-rollup , however, I met a problem when using a component from it in another project. details are in the link below:

to add vue-lib component library I ran

npm install --save @knowscount/vue-lib

and then placed <InputBox /> & import InputBox from '@knowscount/vue-lib , registering the component, yet the page went blank and the folioing error was reported in the console:

[Vue warn]: Error in render: "TypeError: Vue.component is not a function"

found in

---> <App> at src/App.vue
       <Root>
warn @ vue.runtime.esm.js?2b0e:619

and also

vue.runtime.esm.js?2b0e:1888 TypeError: Vue.component is not a function
    at eval (vue-lib.esm.js?ca34:5655)
    at Array.forEach (<anonymous>)
    at installVueLib (vue-lib.esm.js?ca34:5654)
    at resolveAsyncComponent (vue.runtime.esm.js?2b0e:3686)
    at createComponent (vue.runtime.esm.js?2b0e:3200)
    at _createElement (vue.runtime.esm.js?2b0e:3422)
    at createElement (vue.runtime.esm.js?2b0e:3353)
    at vm._c (vue.runtime.esm.js?2b0e:3491)
    at Proxy.render (App.vue?6ad7:13)
    at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548)
logError @ vue.runtime.esm.js?2b0e:1888

everything is open-sourced here . comment if you would like my configuration stuff posted here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM