From 7d0e7beba6cd896a2c5ad0e7fde063abea110941 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 16 Jan 2023 13:16:48 +0100 Subject: [PATCH] fix: adjust fetch error message on the server closes #8536 --- .changeset/nice-mayflies-compete.md | 5 +++++ packages/kit/src/exports/vite/dev/index.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/nice-mayflies-compete.md diff --git a/.changeset/nice-mayflies-compete.md b/.changeset/nice-mayflies-compete.md new file mode 100644 index 000000000000..a3cde2acec4c --- /dev/null +++ b/.changeset/nice-mayflies-compete.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: adjust fetch error message on the server diff --git a/packages/kit/src/exports/vite/dev/index.js b/packages/kit/src/exports/vite/dev/index.js index f20be5190b6f..aa06cf6ad140 100644 --- a/packages/kit/src/exports/vite/dev/index.js +++ b/packages/kit/src/exports/vite/dev/index.js @@ -33,7 +33,7 @@ export async function dev(vite, vite_config, svelte_config) { globalThis.fetch = (info, init) => { if (typeof info === 'string' && !/^\w+:\/\//.test(info)) { throw new Error( - `Cannot use relative URL (${info}) with global fetch — use \`event.fetch\` instead: https://kit.svelte.dev/docs/web-standards#fetch-apis` + `Cannot use relative URL (${info}) with global fetch on the server. If this is called inside a \`load\` function, use \`event.fetch\` instead: https://kit.svelte.dev/docs/web-standards#fetch-apis` ); }