fix(nuxt3): default client-side fetch to use baseURL (#4456)

This commit is contained in:
Daniel Roe 2022-04-20 13:35:33 +01:00 committed by GitHub
parent b82c6e3e96
commit 7b091abcea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
// We set __webpack_public_path via this import with webpack builder // We set __webpack_public_path via this import with webpack builder
import '#build/paths.mjs'
import { createSSRApp, createApp, nextTick } from 'vue' import { createSSRApp, createApp, nextTick } from 'vue'
import { $fetch } from 'ohmyfetch' import { $fetch } from 'ohmyfetch'
import { baseURL } from '#build/paths.mjs'
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app' import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
import '#build/css' import '#build/css'
// @ts-ignore // @ts-ignore
@ -12,7 +12,9 @@ import RootComponent from '#build/root-component.mjs'
import AppComponent from '#build/app-component.mjs' import AppComponent from '#build/app-component.mjs'
if (!globalThis.$fetch) { if (!globalThis.$fetch) {
globalThis.$fetch = $fetch as any globalThis.$fetch = $fetch.create({
baseURL: baseURL()
})
} }
let entry: Function let entry: Function