Closed deleteme closed 1 year ago
You're right, this should be documented. The isomorphic $fetch
helper and corresponding useLazyFetch
composable, which uses $fetch
under the hood, rely on Nitro.
It is already in the latest documentation. https://nuxt.com/docs/bridge/nuxt3-compatible-api#useasync-and-usefetch
Hello @wattanx @danielroe is there a way to use useFetch with nitro disabled?
useFetch
is not available in Nuxt Bridge. Also, there is no way to use useLazyFetch
with nitro: false
.
Instead, useLazyAsyncData
can be used even with nitro: false
.
Environment
Darwin
v18.15.0
2.17.0
2.5.1
yarn@1.22.19
webpack
head
,css
,plugins
,components
,buildModules
,modules
,axios
,build
,bridge
,serverHandlers
,devServerHandlers
,devServer
,typescript
,nitro
@nuxtjs/axios@5.13.6
()
,@nuxt/bridge@3.0.0-28125529.9b0a98e
Reproduction
https://github.com/deleteme/nuxt2-starter-with-bridge/tree/repro-use-lazy-fetch-error
This is a fresh Nuxt 2 app with Bridge. The only modification to the nuxt bridge config is
nitro: false
.Describe the bug
Calling
useLazyFetch
in a Nuxt page Vue component'ssetup()
method throws an error about not having$fetch
defined.Additional context
I didn't find any mention of having to define or implement
$fetch
in the readme or the Bridge docs. I also didn't find anything mentioning not being able to use select composables with only the Nitro server.Logs