Skip to content

Commit

Permalink
fix: adjust fetch error message on the server
Browse files Browse the repository at this point in the history
closes #8536
  • Loading branch information
dummdidumm committed Jan 16, 2023
1 parent 5e12d3e commit 7d0e7be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nice-mayflies-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: adjust fetch error message on the server
2 changes: 1 addition & 1 deletion packages/kit/src/exports/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
);
}

Expand Down

0 comments on commit 7d0e7be

Please sign in to comment.