vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
2.99k stars 158 forks source link

Nuxt 2 having issues with the lib_install function #155

Open dcress opened 2 years ago

dcress commented 2 years ago

First off

Thanks for all the amazing work! Super excited to be using Vue Demi. 🚀


The Problem:

This is likely a user error, but I'm not able to find any examples of consuming a vue-demi plugin in a Nuxt 2 application to help point me in the right direction.

Here's what I have for my package.json in my vue-demi plugin:

  "peerDependencies": {
    "@vue/composition-api": "^1.4.5",
    "vue": "^2.0.0 || >=3.0.0"
  },
  "peerDependenciesMeta": {
    "@vue/composition-api": {
      "optional": true
    }
  },
  "dependencies": {
    "vue-demi": "^0.12.5",
  },
module.exports = {
  chainWebpack: (config) => {
    config.externals(['@vue/composition-api', 'vue']);
  },
};

And in my consuming application:

"dependencies": {
  "my-vue-demi-plugin": "1.0.0",
  "nuxt": "^2.15.2",
}

I'm getting the following error:

Screen Shot 2022-04-25 at 7 18 40 PM

Upon further inspection, I see that there's a default nested inside of external vue reference, which it seems that the install function isn't expecting.

Screen Shot 2022-04-25 at 7 11 52 PM Screen Shot 2022-04-25 at 7 20 01 PM

What am I missing here? 🤷 🤔

dcress commented 2 years ago

@antfu This seems possibly related to this: https://github.com/vueuse/vue-demi/issues/130