You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set up a component library with vue-demi (Vite + Vue 3 + Setup Script). Importing thing work fine in Vue 3 apps, but fail for Vue 2. The resulting bundle looks like this:
In Vue 2 I run into Uncaught TypeError: Object(...) is not a function error with defineComponent(). I suppose it should be importing from "vue-demi" instead of "vue"?
exportdefaultdefineConfig({plugins: [vue()],build: {lib: {entry: path.resolve(__dirname,"src/lib.ts"),name: "myLib",fileName: (format)=>`lib.${format}.js`,},rollupOptions: {// make sure to externalize deps that shouldn't be bundled// into your libraryexternal: ["vue"],output: {// Provide global variables to use in the UMD build// for externalized depsglobals: {vue: "Vue",},},},},optimizeDeps: {exclude: ["vue-demi"],},});
The text was updated successfully, but these errors were encountered:
As you mentioned, I think this is a matter of the output file importing stuffs from "vue" instead of "vue-demi".
Currently I'm thinking this could be solved by tinkering the vite.config.js(ts)file but have no idea how..
I'm trying to set up a component library with vue-demi (Vite + Vue 3 + Setup Script). Importing thing work fine in Vue 3 apps, but fail for Vue 2. The resulting bundle looks like this:
BaseButton.vue to be imported by Vue2/3 App
Build output:
In Vue 2 I run into
Uncaught TypeError: Object(...) is not a function
error withdefineComponent()
. I suppose it should be importing from "vue-demi" instead of "vue"?Package.json
vite.config.ts
The text was updated successfully, but these errors were encountered: