enkot / nuxt-open-fetch

Generate zero-overhead, typed OpenAPI clients for Nuxt.
https://nuxt-open-fetch.vercel.app
MIT License
114 stars 10 forks source link

Runtime error, createOpenFetch is not defined #18

Closed gstefler closed 6 months ago

gstefler commented 7 months ago

With the following config:

export default defineNuxtConfig({
    modules: ['nuxt-open-fetch'],
    ssr: false,
    openFetch: {
        clients: {
            campus: {
                schema: 'http://localhost:8080/v3/api-docs',
                baseURL: 'http://localhost:8080',
            }
        }
    },
    runtimeConfig: {
        openFetch: {
            campus: {
                schema: 'http://localhost:8080/v3/api-docs',
                baseURL: 'http://localhost:8080',
            }
        }
    },
    devtools: {enabled: true}
})

I get the following error:

  nuxt.js:97 [nuxt] error caught during app initialization ReferenceError: createOpenFetch is not defined
  at plugin.mjs?v=3191f25d:7:25
  at Array.reduce (<anonymous>)
  at plugin.mjs?v=3191f25d:5:38
  at client.mjs:29:69
  at executeAsync (index.mjs?v=3191f25d:111:19)
  at setup (client.mjs:29:43)
  at nuxt.js:110:60
  at fn (nuxt.js:153:44)
  at Object.runWithContext (runtime-core.esm-bundler.js:3873:18)
  at callWithNuxt (nuxt.js:158:24)

Versions:

"@nuxt/devtools": "latest",
"nuxt": "^3.8.2",
"nuxt-open-fetch": "^0.3.0",
"vue": "^3.3.8",
"vue-router": "^4.2.5"

All the typse work as excpected.

trc-mathieu commented 7 months ago

I submitted a PR to fix this: https://github.com/enkot/nuxt-open-fetch/pull/17