Git Product home page Git Product logo

Comments (7)

antfu avatar antfu commented on May 25, 2024 4

Done with v0.3.0. Check it out :)

from vue-demi.

NickBolles avatar NickBolles commented on May 25, 2024

I actually can't tell if it's this module, which is causing 2 copies of @Vue/Composition-api, or if it's the upgrade in @vue/composition-api itself. Either way, I don't think that vue-demi should have @vue/composition-api as a dependency.

from vue-demi.

NickBolles avatar NickBolles commented on May 25, 2024

update: this does indeed look like it's causing my issues. Here's my packages, before - with @vue/apollo-composable@ alpha10 and after downgrade - @vue/apollo-composable@ alpha9. This is the same version of @vue/composition-api

Before downgrade

client> yarn why @vue/composition-api
├─ @nuxtjs/composition-api@npm:0.12.2
│  └─ @vue/composition-api@npm:1.0.0-beta.10 (via npm:^1.0.0-beta.10)
│
├─ @nuxtjs/composition-api@npm:0.12.2 [0c378]
│  └─ @vue/composition-api@npm:1.0.0-beta.10 [c4e01] (via npm:^1.0.0-beta.10 [c4e01])
│
└─ vue-demi@npm:0.2.0
   └─ @vue/composition-api@npm:1.0.0-beta.10 [c4e01] (via npm:^1.0.0-beta.10 [c4e01])
client> yarn why vue-demi
├─ @vue/apollo-composable@npm:4.0.0-alpha.10
│  └─ vue-demi@npm:0.2.0 (via npm:latest)
│
└─ @vue/apollo-composable@npm:4.0.0-alpha.10 [68254]
   └─ vue-demi@npm:0.2.0 (via npm:latest)

After downgrade to @vue/apollo-composable

graphql> yarn why @vue/composition-api
├─ @nuxtjs/composition-api@npm:0.12.2
│  └─ @vue/composition-api@npm:1.0.0-beta.10 (via npm:^1.0.0-beta.10)
│
└─ @nuxtjs/composition-api@npm:0.12.2 [0c378]
   └─ @vue/composition-api@npm:1.0.0-beta.10 [c4e01] (via npm:^1.0.0-beta.10 [c4e01])
graphql> yarn why @vue/apollo-composable
└─ @App/Client@workspace:packages/client
   └─ @vue/apollo-composable@npm:4.0.0-alpha.9 [0c378] (via npm:4.0.0-alpha.9 [0c378])

The errors I would get are, Maximum call stack exceeded. It was an infinite loop in nextTick, and I tracked it down, in my case, to being called by the first nuxt module that initialized and tried to use a composition API. In my case that was @nuxtjs/auth-next

I'm still unclear why this was an actual issue, since I would expect yarn to dedupe the package and only have one copy. but it really appears that this is the issue to me.

from vue-demi.

antfu avatar antfu commented on May 25, 2024

Could you share a minimal reproduce repo? Thanks.

@vue/composition-api becomes a dependency because the philosophy of vue-demi is trying to abstract the lower layer of details to exposing the APIs for 2 & 3 as the same as possible.

from vue-demi.

Demivan avatar Demivan commented on May 25, 2024

@NickBolles I had similar issue with yarn and found out that yarn does not always dedupe on update. Removing lock file and installing packages again fixed dedupe issues for me.

But that is exactly what peer dependencies are for, so package does not install dependency itself but uses dependency from parent package.

composition-api could even be optional peer dependency so users that use vue@3 don't get warning that composition-api is not installed. Right now users that use vue@3 will have composition-api installed even though it is not needed.

Same deal with Vue. It should be in peer dependencies. With range that allows vue@2 and vue@3. I'm using yarn@2 and it is stricter about checking dependencies. It does not allow package to import dependency that is not in dependencies or peer dependencies. I will create issue about yarn@2 with reproduce repo later.

from vue-demi.

NickBolles avatar NickBolles commented on May 25, 2024

Thanks for the confirmation @Demivan I'm also using Yarn 2

@antfu honestly I tried, but in my case it requires setting up Nuxt, Nuxt auth, composition API and Apollo. It takes a while. But I did do the investigation. To find the root cause and we have at least one other confirmation.

Our argument is that dependency is wrong. It happens to also have been causing a functional issue for me, and probably will for others. Either way, optional peer dependency is the right thing to do.

If you really need a repro I can spend some time later today putting it together.

from vue-demi.

antfu avatar antfu commented on May 25, 2024

Sure, I will change it to peerDeps. Thanks

from vue-demi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.