Giter Site home page Giter Site logo

Comments (4)

danielroe avatar danielroe commented on July 22, 2024 1

The error is to flag up to users who may be unaware. I think in your case handling it manually is right.

It's common, for example, to have a server plugin injecting something, e.g. $someVar, which is not accessible on the client, and for users to think this is a Nuxt bug.

I think specifying a hard dependency on another plugin means it's needed, and we can't just assume that the user has accounted for it not being available on the client side.

So I think we'll leave this as is, but please do feel free to circle back if you think there's a better solution (or better log message)! 🙏

from nuxt.js.

stackblitz avatar stackblitz commented on July 22, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.js.

danielroe avatar danielroe commented on July 22, 2024

I think this makes sense, as the dependency is unavailable on the client...

Why do you think:

I'm not sure whether it actually affects anything, but even the error message should probably not show up.

from nuxt.js.

CernyMatej avatar CernyMatej commented on July 22, 2024

It's a tricky situation. On one hand, it makes complete sense to show an error message when a dependency is not available on the client. However, in use cases like mine — where I want it to be a dependency on the server but not on the client — it might be misleading.

Maybe I'm thinking about it wrong…

I'm using the plugin to fetch some initial configuration on the server and store it in shared state using useState.

I removed the .server suffix from the dependency and added an early return when executed on the client to make the error message go away.

from nuxt.js.

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.