diff --git a/playground/app.vue b/playground/app.vue index 58db5ce..0ef1227 100644 --- a/playground/app.vue +++ b/playground/app.vue @@ -1,8 +1,7 @@ - diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index 02c19fa..e470fe8 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -1,5 +1,4 @@ export default defineNuxtConfig({ - modules: ['../src/module'], - myModule: {}, - devtools: { enabled: true } -}) + modules: ["../src/module"], + devtools: { enabled: true }, +}); diff --git a/playground/server/api/hello.ts b/playground/server/api/hello.ts new file mode 100644 index 0000000..0932072 --- /dev/null +++ b/playground/server/api/hello.ts @@ -0,0 +1 @@ +export default defineEventHandler(() => "hello"); diff --git a/src/runtime/00.fetch.client.ts b/src/runtime/00.fetch.client.ts index 68c50ac..117941f 100644 --- a/src/runtime/00.fetch.client.ts +++ b/src/runtime/00.fetch.client.ts @@ -1,5 +1,6 @@ // @ts-nocheck import destr from "destr"; +import { defineNuxtPlugin } from "#app"; export interface ResponseMap { blob: Blob; @@ -43,7 +44,7 @@ export function detectResponseType(_contentType = ""): ResponseType { return "blob"; } -export default () => { +export default defineNuxtPlugin(() => { const nullBodyResponses = new Set([101, 204, 205, 304]); const _fetch = globalThis.$fetch; async function $$fetch(arg1, options = {}, ...rest) { @@ -90,4 +91,4 @@ export default () => { Object.keys(_fetch).forEach((key) => { globalThis.$fetch[key] = _fetch[key]; }); -}; +});