nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
945 stars 199 forks source link

Missing type definition in nuxt.config.ts #502

Closed HuakunShen closed 1 year ago

HuakunShen commented 1 year ago

Environment

Nuxi 3.3.3

RootDir: /Users/hacker/Desktop/nuxt-app Nuxt project info: (copied to clipboard)


Describe the bug

I followed https://apollo.nuxtjs.org/getting-started/quick-start and installed "@nuxtjs/apollo": "^5.0.0-alpha.6", but always getting error saying that Object literal may only specify known properties, and 'apollo' does not exist in type 'NuxtConfig'.ts

image

Expected behaviour

nuxt.config.ts should accept apollo config.

Reproduction

npx nuxi init
npm i -D @nuxtjs/apollo@next

Fill in

import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  modules: ['@nuxtjs/apollo'],

  apollo: {
    clients: {
      default: {
        httpEndpoint: 'https://api.spacex.land/graphql'
      }
    },
  },
})

Additional context

Reproduced on ubuntu 20.04

Logs

No response

slavanossar commented 1 year ago

This was a bug in nuxt due to missing @types/node peer dependency, fixed in 3.4.0

https://github.com/nuxt/nuxt/issues/20040

HuakunShen commented 1 year ago

This was a bug in nuxt due to missing @types/node peer dependency, fixed in 3.4.0

nuxt/nuxt#20040

Thanks!

pagas commented 10 months ago

Windows 11

{ "name": "nuxt-app", "private": true, "type": "module", "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "devDependencies": { "@nuxt/devtools": "latest", "@nuxtjs/apollo": "5.0.0-alpha.8", "@nuxtjs/tailwindcss": "^6.9.4", "@tailwindcss/typography": "^0.5.10", "nuxt": "^3.8.1", "nuxt-icon": "^0.6.1", "vue": "^3.3.7", "vue-router": "^4.2.5" }, "dependencies": { "@headlessui/vue": "^1.7.16", "@heroicons/vue": "^2.0.18", "@nuxt/content": "^2.9.0" } }

Still have the same issue on 3.8 nuxt.

image

alex4506 commented 10 months ago

3.8.1 still has