Giter VIP home page Giter VIP logo

nuxt3-apollo-module's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nuxt3-apollo-module's Issues

Does not work with nuxt3

The package installs without any problems. However the moment when I start my dev server I get this error:
ERROR Failed to resolve import "@vue/apollo-composable".
When I look deeper in the node_modules that package is indeed missing.
The moment I want to install the package my self I get a peer dependency error.

This happens with nuxt 3.0.0-rc.3 and nuxt 3.0.0-rc.4 (latest)

On Login helper

Hello, can we set the token for future requests after logging in?
In vue2 version there was $apollohelpers.onlogin()
If don`t how i add bearer token before request?

[nuxt] [request error] [unhandled] [500] __DEV__ is not defined

I have this error in nuxt3 - production build only (npm run build - > npm run preview)

Works fine in dev mode (npm run dev)

It probably has to do with SSR?

Stack:
"nuxt": "^3.0.0-rc.11"
"@nuxt3/apollo-module": "^0.1.1",

Nuxi 3.0.0-rc.11
information_source Node.js version: 16.14.0
information_source Preset: node-server
information_source Working dir: .output
information_source Loading .env. This will not be loaded when running the server in production.
information_source Starting preview command: node ./server/index.mjs

Listening http://[::]:3000

Error:
[nuxt] [request error] [unhandled] [500] DEV is not defined
at createHttpLink (./server/chunks/app/server.mjs:4252:3)
at ./server/chunks/app/server.mjs:10723:22
at fn (./server/chunks/app/server.mjs:238:27)
at Object.callAsync (./server/node_modules/unctx/dist/index.mjs:49:19)
at callWithNuxt (./server/chunks/app/server.mjs:240:23)
at applyPlugin (./server/chunks/app/server.mjs:209:39)
at applyPlugins (./server/chunks/app/server.mjs:218:11)
at async createNuxtAppServer (./server/chunks/app/server.mjs:10843:7)
at async Object.renderToString (./server/node_modules/vue-bundle-renderer/dist/runtime.mjs:172:19)
at async ./server/chunks/handlers/renderer.mjs:367:21

Cannot start nuxt: Cannot find module 'nuxt3'

Hi, it's me again, after the last nuxt update, when I install the package it returns the error "Cannot start nuxt: Cannot find module 'nuxt3' ".
Removing the package it works again, I believe it is some reference to the nuxt3 package that no longer exists, after the RC of nuxt it became only nuxt.
image

No way to pass options to InMemoryCache constructor

Problem
There is no way to neither pass cache options nor pass custom cache.

Scenario
In my particular scenario I need to pass possibleTypes to cache constructor.

Proposed solutions

  1. Allow user to pass path to the config file. For example:
export default defineNuxtConfig({
  apollo: {
        clientConfigs: {
            default: "@/apollo.client.js"
        }
  }
})

Where apollo.client.js file exports a function that returns client options see https://www.apollographql.com/docs/react/api/core/ApolloClient/#the-apolloclient-constructor.

For example:

import {InMemoryCache} from "@apollo/client";
import possibleTypes from "./possibleTypes.json"

export default () => ({cache: new InMemoryCache({ possibleTypes })})
  1. Allow to pass options into cache constructor.
    For example in your nuxt.config.js
{
       apollo: {
        clientConfigs: {
            default: {
                uri: "http://localhost:3000/api",
                // These options will be passed into InMemoryCache constructor
                cache: {
                   possibleTypes
                }
            },
}

Doesnt properly work with ssr: false; nuxt3

Disabling ssr ( ssr: false) produces this error

Unexpected token u in JSON at position 0

commenting out this line works

 cache.restore(JSON.parse(JSON.stringify(nuxt.payload.data["apollo-" + clientId])));

Screenshot from 2022-07-20 14-02-20

Not sure why this happened

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.