Skip to content

dependency issue with @vue/composition-api #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eunjae-lee opened this issue May 31, 2021 · 4 comments
Closed

dependency issue with @vue/composition-api #67

eunjae-lee opened this issue May 31, 2021 · 4 comments

Comments

@eunjae-lee
Copy link

eunjae-lee commented May 31, 2021

Hello, I'm working on supporting both Vue2 and Vue3 in Vue InstantSearch.

I used vue-demi inside Vue InstantSearch. After installing Vue InstantSearch in an empty project, it gives me this error:

 ERROR  Failed to compile with 1 error                              17:19:50

This dependency was not found:

* @vue/composition-api in ./node_modules/vue-demi/lib/index.esm.js

To install it, you can run: npm install --save @vue/composition-api

More details:

In the package.json of Vue InstantSearch,

  "dependencies": {
    "vue-demi": "^0.9.1",
    // ...
  },
  "peerDependencies": {
    "vue": "^2.6.0 || >=3.0.0-rc.0",
    "@vue/composition-api": "^1.0.0-beta.1",
    // ...
  },
  "peerDependenciesMeta": {
    "@vue/composition-api": {
      "optional": true
    }
  },
  "devDependencies": {
    "vue": "2.5.18",
    // ...
  }

You can see the pull request here. And I deployed the temporary build of the pull request via CodeSandbox, which is:

https://pkg.csb.dev/algolia/vue-instantsearch/commit/3341e045/vue-instantsearch

Now I put it in an example:
p9ez8.zip

If you run yarn install && yarn serve it will show the error message above.

In Vue InstantSearch, we do not use @vue/composition-api, so left it as optional. The error message goes away only when I install it as a dependency inside the example.

Do you have any idea? Thanks!

  • macOS: 11.3.1
  • node: 12.19.0
@antfu
Copy link
Member

antfu commented May 31, 2021

@vue/composition-api is optional only when using Vue 3, so the user environment should be either:

  • vue@2 + @vue/composition-api
  • vue@3

@eunjae-lee
Copy link
Author

@antfu oh I didn't see that. Do you happen to have a plan to support vue@2 without composition api?

@antfu
Copy link
Member

antfu commented May 31, 2021

Currently no. vue-demi only make sense when using Composition API. But on the other hand, Vue 2.7 will have the @vue/composition-api plugin builtin, which is planned in Q3 this year.

@eunjae-lee
Copy link
Author

@antfu Thanks for the comment. Good to know. I should write something small that does the similar thing as vue-demi.
Have a good day!

renatodeleao added a commit to renatodeleao/v-click-outside that referenced this issue Jul 19, 2022
using vue-demi requires that vue2.6 projects install "@vue/composition-api", always! Even though I believe is the norm in 2.6.x projects but still kind of bummer to get an install error. vue-demi lists @vue/composition-api as optional peer dependency because it would otherwise install it for vue2.7 and vue3.x projects. We could list @vue/composition-api as dependency as well to overcome the install issue, but we're not using anything on this package so why complicate things?

1. I've removed vue-demi altogether, replaced the only thing we've use isVue3 with simply version regexp
1. the swap-vue.js from vuelidate allow us to keep the isomorphic testing to ensure it works everything

Related issues:
vueuse/vue-demi#67
vueuse/vue-demi#7
renatodeleao added a commit to renatodeleao/v-click-outside that referenced this issue Jul 19, 2022
using vue-demi requires that vue2.6 projects install "@vue/composition-api", always! Even though I believe is the norm in 2.6.x projects but still kind of bummer to get an install error. vue-demi lists @vue/composition-api as optional peer dependency because it would otherwise install it for vue2.7 and vue3.x projects. We could list @vue/composition-api as dependency as well to overcome the install issue, but we're not using anything on this package so why complicate things?

1. I've removed vue-demi altogether, replaced the only thing we've use isVue3 with simply version regexp
1. the swap-vue.js from vuelidate allow us to keep the isomorphic testing to ensure it works everything

Related issues:
vueuse/vue-demi#67
vueuse/vue-demi#7
renatodeleao added a commit to renatodeleao/v-click-outside that referenced this issue Jul 19, 2022
using vue-demi requires that vue2.6 projects install "@vue/composition-api", always! Even though I believe is the norm in 2.6.x projects but still kind of bummer to get an install error. vue-demi lists @vue/composition-api as optional peer dependency because it would otherwise install it for vue2.7 and vue3.x projects. We could list @vue/composition-api as dependency as well to overcome the install issue, but we're not using anything on this package so why complicate things?

1. I've removed vue-demi altogether, replaced the only thing we've use isVue3 with simply version regexp
1. the swap-vue.js from vuelidate allow us to keep the isomorphic testing to ensure it works everything

Related issues:
vueuse/vue-demi#67
vueuse/vue-demi#7
renatodeleao added a commit to renatodeleao/v-click-outside that referenced this issue Jul 19, 2022
using vue-demi requires that vue2.6 projects install "@vue/composition-api", always! Even though I believe is the norm in 2.6.x projects but still kind of bummer to get an install error. vue-demi lists @vue/composition-api as optional peer dependency because it would otherwise install it for vue2.7 and vue3.x projects. We could list @vue/composition-api as dependency as well to overcome the install issue, but we're not using anything on this package so why complicate things?

1. I've removed vue-demi altogether, replaced the only thing we've use isVue3 with simply version regexp
1. the swap-vue.js from vuelidate allow us to keep the isomorphic testing to ensure it works everything

Related issues:
vueuse/vue-demi#67
vueuse/vue-demi#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants