Repository: sveltejs/kit
Pull request #7296 (2022-10-17 20:51:50)

remove non-browser code from browser builds
This is a small thing but I noticed we're including this code in production client builds, quite unnecessarily. There might be other cases, and after this PR we can just wrap them in a `if (!__SVELTEKIT_BROWSER__)` block to remove them from client builds.

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. All changesets should be `patch` until SvelteKit 1.0


changeset-bot[bot]: ###  🦋  Changeset detected

Latest commit: 82d2601d2705be8ce5912e9fb46a729f81a85be7

**The changes in this PR will be included in the next version bump.**

<details><summary>This PR includes changesets to release 1 package</summary>

  | Name          | Type  |
| ------------- | ----- |
| @sveltejs/kit | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/sveltejs/kit/new/remove-dead-browser-code?filename=.changeset/olive-days-decide.md&value=---%0A%22%40sveltejs%2Fkit%22%3A%20patch%0A---%0A%0Aremove%20non-browser%20code%20from%20browser%20builds%0A)



Patch:
diff --git a/.changeset/pre.json b/.changeset/pre.json
index caf05c937..efaab784e 100644
--- a/.changeset/pre.json
+++ b/.changeset/pre.json
@@ -973,6 +973,7 @@
     "serious-elephants-dress",
     "serious-fireants-drum",
     "serious-horses-rule",
+    "serious-llamas-smoke",
     "serious-panthers-sing",
     "serious-vans-arrive",
     "seven-ads-yawn",
@@ -1131,6 +1132,7 @@
     "spotty-countries-protect",
     "spotty-dancers-clean",
     "spotty-dragons-wait",
+    "spotty-kangaroos-peel",
     "spotty-ladybugs-teach",
     "spotty-parents-love",
     "spotty-phones-love",
@@ -1386,6 +1388,7 @@
     "wicked-spoons-leave",
     "wicked-terms-agree",
     "wild-badgers-brake",
+    "wild-bags-cheat",
     "wild-beans-happen",
     "wild-clouds-hear",
     "wild-cooks-drive",
diff --git a/.changeset/real-taxis-march.md b/.changeset/real-taxis-march.md
new file mode 100644
index 000000000..043e8dc75
--- /dev/null
+++ b/.changeset/real-taxis-march.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Enable removal of non-browser code from client builds
diff --git a/.changeset/serious-llamas-smoke.md b/.changeset/serious-llamas-smoke.md
new file mode 100644
index 000000000..7a33ae3e3
--- /dev/null
+++ b/.changeset/serious-llamas-smoke.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[fix] more informative serialization error messages
diff --git a/.changeset/spotty-kangaroos-peel.md b/.changeset/spotty-kangaroos-peel.md
new file mode 100644
index 000000000..db342321a
--- /dev/null
+++ b/.changeset/spotty-kangaroos-peel.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[fix] add `$types` to includes for better DX
diff --git a/.changeset/tame-bats-tell.md b/.changeset/tame-bats-tell.md
new file mode 100644
index 000000000..9480534b0
--- /dev/null
+++ b/.changeset/tame-bats-tell.md
@@ -0,0 +1,6 @@
+---
+'@sveltejs/adapter-static': patch
+'@sveltejs/kit': patch
+---
+
+[feat] more info about prerendering errors, add strict option to adapter-static
diff --git a/documentation/docs/13-page-options.md b/documentation/docs/13-page-options.md
index ff9cba351..3ea49fe43 100644
--- a/documentation/docs/13-page-options.md
+++ b/documentation/docs/13-page-options.md
@@ -74,11 +74,11 @@ Note that this will disable client-side routing for any navigation from this pag
 
 #### Troubleshooting
 
-If you encounter an error like 'The following routes were marked as prerenderable, but were not prerendered' it's because the route in question (or a parent layout, if it's a page) has `export const prerender = true` but the page wasn't actually prerendered.
+If you encounter an error like 'The following routes were marked as prerenderable, but were not prerendered' it's because the route in question (or a parent layout, if it's a page) has `export const prerender = true` but the page wasn't actually prerendered, because it wasn't reached by the prerendering crawler.
 
 Since these routes cannot be dynamically server-rendered, this will cause errors when people try to access the route in question. There are two ways to fix it:
 
-* Ensure that SvelteKit can find the route by following links from [`config.kit.prerender.entries`](/docs/configuration#prerender). The pages containing the links (e.g. your `/` page) must _themselves_ be prerenderable, or they will be ignored
+* Ensure that SvelteKit can find the route by following links from [`config.kit.prerender.entries`](/docs/configuration#prerender). Add links to dynamic routes (i.e. pages with `[parameters]` ) to this option if they are not found through crawling the other entry points, else they are not prerendered because SvelteKit doesn't know what value the parameters should have. Pages not marked as prerenderable will be ignored and their links to other pages will not be crawled, even if some of them would be prerenderable.
 * Change `export const prerender = true` to `export const prerender = 'auto'`. Routes with `'auto'` can be dynamically server rendered
 
 ### ssr
diff --git a/documentation/docs/16-configuration.md b/documentation/docs/16-configuration.md
index 0b9319dfd..e5f145453 100644
--- a/documentation/docs/16-configuration.md
+++ b/documentation/docs/16-configuration.md
@@ -252,7 +252,7 @@ See [Prerendering](/docs/page-options#prerender). An object containing zero or m
 - `concurrency` — how many pages can be prerendered simultaneously. JS is single-threaded, but in cases where prerendering performance is network-bound (for example loading content from a remote CMS) this can speed things up by processing other tasks while waiting on the network response
 - `crawl` — determines whether SvelteKit should find pages to prerender by following links from the seed page(s)
 - `enabled` — set to `false` to disable prerendering altogether
-- `entries` — an array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all non-dynamic routes (i.e. pages with no `[parameters]` )
+- `entries` — an array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all non-dynamic routes (i.e. pages with no `[parameters]`, because SvelteKit doesn't know what value the parameters should have)
 - `onError`
 
   - `'fail'` — (default) fails the build when a routing error is encountered when following a link
diff --git a/packages/adapter-static/README.md b/packages/adapter-static/README.md
index a884130dd..540239ae8 100644
--- a/packages/adapter-static/README.md
+++ b/packages/adapter-static/README.md
@@ -18,7 +18,8 @@ export default {
       pages: 'build',
       assets: 'build',
       fallback: null,
-      precompress: false
+      precompress: false,
+      strict: true
     })
   }
 };
@@ -71,6 +72,10 @@ Specify a fallback page for SPA mode, e.g. `index.html` or `200.html` or `404.ht
 
 If `true`, precompresses files with brotli and gzip. This will generate `.br` and `.gz` files.
 
+### strict
+
+By default, `adapter-static` checks that either all pages and endpoints (if any) of your app were prerendered, or you have the `fallback` option set. This check exists to prevent you from accidentally publishing an app where some parts of it are not accessible, because they are not contained in the final output. If you know this is ok (for example when a certain page only exists conditionally), you can set `strict` to `false` to turn off this check.
+
 ## SPA mode
 
 You can use `adapter-static` to create a single-page app or SPA by specifying a **fallback page**.
diff --git a/packages/adapter-static/index.d.ts b/packages/adapter-static/index.d.ts
index a85449101..101e02fde 100644
--- a/packages/adapter-static/index.d.ts
+++ b/packages/adapter-static/index.d.ts
@@ -5,6 +5,7 @@ export interface AdapterOptions {
 	assets?: string;
 	fallback?: string;
 	precompress?: boolean;
+	strict?: boolean;
 }
 
 export default function plugin(options?: AdapterOptions): Adapter;
diff --git a/packages/adapter-static/index.js b/packages/adapter-static/index.js
index a32a8010b..37c3f8538 100644
--- a/packages/adapter-static/index.js
+++ b/packages/adapter-static/index.js
@@ -24,13 +24,31 @@ export default function (options) {
 					};
 				});
 
-				if (dynamic_routes.length > 0) {
+				if (dynamic_routes.length > 0 && options.strict) {
 					const prefix = path.relative('.', builder.config.kit.files.routes);
+					const has_param_routes = dynamic_routes.some((route) => route.includes('['));
+					const config_option =
+						has_param_routes || JSON.stringify(builder.config.kit.prerender.entries) !== '["*"]'
+							? `  - adjust the \`prerender.entries\` config option ${
+									has_param_routes
+										? '(routes with parameters are not part of entry points by default)'
+										: ''
+							  } — see https://kit.svelte.dev/docs/configuration#prerender for more info.`
+							: '';
+
 					builder.log.error(
-						`@sveltejs/adapter-static: all routes must be fully prerenderable (unless using the 'fallback' option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). Try adding \`export const prerender = true\` to your root +layout.js/.ts file — see https://kit.svelte.dev/docs/page-options#prerender for more details`
-					);
-					builder.log.error(
-						dynamic_routes.map((id) => `  - ${path.posix.join(prefix, id)}`).join('\n')
+						`@sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic:
+${dynamic_routes.map((id) => `  - ${path.posix.join(prefix, id)}`).join('\n')}
+
+You have the following options:
+  - set the \`fallback\` option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode for more info.
+  - add \`export const prerender = true\` to your root \`+layout.js/.ts\` or \`+layout.server.js/.ts\` file. This will try to prerender all pages.
+  - add \`export const prerender = true\` to any \`+server.js/ts\` files that are not fetched by page \`load\` functions.
+${config_option}
+  - pass \`strict: false\` to \`adapter-static\` to ignore this error. Only do this if you are sure you don't need the routes in question in your final app, as they will be unavailable. See https://github.com/sveltejs/kit/tree/master/packages/adapter-static#strict for more info.
+
+If this doesn't help, you may need to use a different adapter. @sveltejs/adapter-static can only be used for sites that don't need a server for dynamic rendering, and can run on just a static file server.
+See https://kit.svelte.dev/docs/page-options#prerender for more details`
 					);
 					throw new Error('Encountered dynamic routes');
 				}
diff --git a/packages/create-svelte/CHANGELOG.md b/packages/create-svelte/CHANGELOG.md
index 358935e3e..d1a0146e0 100644
--- a/packages/create-svelte/CHANGELOG.md
+++ b/packages/create-svelte/CHANGELOG.md
@@ -1,5 +1,11 @@
 # create-svelte
 
+## 2.0.0-next.185
+
+### Patch Changes
+
+- Warn user when they accidentally try to publish the `./` directory ([#7280](https://github.com/sveltejs/kit/pull/7280))
+
 ## 2.0.0-next.184
 
 ### Patch Changes
diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json
index 81e0e3b09..13a377fc5 100644
--- a/packages/create-svelte/package.json
+++ b/packages/create-svelte/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "create-svelte",
-	"version": "2.0.0-next.184",
+	"version": "2.0.0-next.185",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index 4f35edc13..8775815b0 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,13 @@
 # @sveltejs/kit
 
+## 1.0.0-next.517
+
+### Patch Changes
+
+- [fix] more informative serialization error messages ([#7303](https://github.com/sveltejs/kit/pull/7303))
+
+* [fix] add `$types` to includes for better DX ([#7301](https://github.com/sveltejs/kit/pull/7301))
+
 ## 1.0.0-next.516
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index 97d2e39a3..224d084ad 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.0.0-next.516",
+	"version": "1.0.0-next.517",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/core/adapt/builder.js b/packages/kit/src/core/adapt/builder.js
index 3c1dc0bcd..c95921a4b 100644
--- a/packages/kit/src/core/adapt/builder.js
+++ b/packages/kit/src/core/adapt/builder.js
@@ -33,10 +33,11 @@ export function create_builder({ config, build_data, routes, prerendered, log })
 		async createEntries(fn) {
 			/** @type {import('types').RouteDefinition[]} */
 			const facades = routes.map((route) => {
+				/** @type {Set<import('types').HttpMethod>} */
 				const methods = new Set();
 
 				if (route.page) {
-					methods.add('SET');
+					methods.add('GET');
 				}
 
 				if (route.endpoint) {
diff --git a/packages/kit/src/core/prerender/prerender.js b/packages/kit/src/core/prerender/prerender.js
index 65d755c13..40d04eb4d 100644
--- a/packages/kit/src/core/prerender/prerender.js
+++ b/packages/kit/src/core/prerender/prerender.js
@@ -431,9 +431,9 @@ export async function prerender() {
 
 	if (not_prerendered.length > 0) {
 		throw new Error(
-			`The following routes were marked as prerenderable, but were not prerendered:\n${not_prerendered.map(
+			`The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${not_prerendered.map(
 				(id) => `  - ${id}`
-			)}\n\nSee https://kit.svelte.dev/docs/page-options#prerender-troubleshooting for more info`
+			)}\n\nSee https://kit.svelte.dev/docs/page-options#prerender-troubleshooting for info on how to solve this`
 		);
 	}
 
diff --git a/packages/kit/src/core/sync/write_tsconfig.js b/packages/kit/src/core/sync/write_tsconfig.js
index 8e3d42ebd..b97b1a084 100644
--- a/packages/kit/src/core/sync/write_tsconfig.js
+++ b/packages/kit/src/core/sync/write_tsconfig.js
@@ -46,7 +46,7 @@ export function write_tsconfig(config, cwd = process.cwd()) {
 	/** @param {string} file */
 	const config_relative = (file) => posixify(path.relative(config.outDir, file));
 
-	const include = ['ambient.d.ts', config_relative('vite.config.ts')];
+	const include = ['ambient.d.ts', './types/**/$types.d.ts', config_relative('vite.config.ts')];
 	for (const dir of [config.files.routes, config.files.lib]) {
 		const relative = project_relative(path.dirname(dir));
 		include.push(config_relative(`${relative}/**/*.js`));
diff --git a/packages/kit/src/exports/vite/build/utils.js b/packages/kit/src/exports/vite/build/utils.js
index da3134c31..d3bccfeb7 100644
--- a/packages/kit/src/exports/vite/build/utils.js
+++ b/packages/kit/src/exports/vite/build/utils.js
@@ -136,6 +136,7 @@ export function get_default_build_config({ config, input, ssr, outDir }) {
 			__SVELTEKIT_APP_VERSION__: JSON.stringify(config.kit.version.name),
 			__SVELTEKIT_APP_VERSION_FILE__: JSON.stringify(`${config.kit.appDir}/version.json`),
 			__SVELTEKIT_APP_VERSION_POLL_INTERVAL__: JSON.stringify(config.kit.version.pollInterval),
+			__SVELTEKIT_BROWSER__: ssr ? 'false' : 'true',
 			__SVELTEKIT_DEV__: 'false'
 		},
 		publicDir: ssr ? false : config.kit.files.assets,
diff --git a/packages/kit/src/exports/vite/dev/index.js b/packages/kit/src/exports/vite/dev/index.js
index 489d78c9e..e8dc10837 100644
--- a/packages/kit/src/exports/vite/dev/index.js
+++ b/packages/kit/src/exports/vite/dev/index.js
@@ -30,6 +30,9 @@ const cwd = process.cwd();
 export async function dev(vite, vite_config, svelte_config) {
 	installPolyfills();
 
+	// @ts-expect-error
+	globalThis.__SVELTEKIT_BROWSER__ = false;
+
 	sync.init(svelte_config, vite_config.mode);
 
 	/** @type {import('types').Respond} */
diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js
index dd9d4f0e5..4f8b9ee42 100644
--- a/packages/kit/src/exports/vite/index.js
+++ b/packages/kit/src/exports/vite/index.js
@@ -249,8 +249,9 @@ function kit() {
 					}
 				},
 				define: {
-					__SVELTEKIT_DEV__: 'true',
-					__SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0'
+					__SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0',
+					__SVELTEKIT_BROWSER__: config_env.ssrBuild ? 'false' : 'true',
+					__SVELTEKIT_DEV__: 'true'
 				},
 				publicDir: svelte_config.kit.files.assets,
 				resolve: {
diff --git a/packages/kit/src/runtime/server/data/index.js b/packages/kit/src/runtime/server/data/index.js
index 3e0ea3890..33c9a68a7 100644
--- a/packages/kit/src/runtime/server/data/index.js
+++ b/packages/kit/src/runtime/server/data/index.js
@@ -111,7 +111,7 @@ export async function render_data(event, route, options, state) {
 			nodes: nodes.slice(0, length)
 		};
 
-		return data_response(server_data);
+		return data_response(server_data, event);
 	} catch (e) {
 		const error = normalize_error(e);
 
@@ -122,10 +122,10 @@ export async function render_data(event, route, options, state) {
 				location: error.location
 			};
 
-			return data_response(server_data);
+			return data_response(server_data, event);
 		} else {
 			// TODO make it clearer that this was an unexpected error
-			return data_response(handle_error_and_jsonify(event, options, error));
+			return data_response(handle_error_and_jsonify(event, options, error), event);
 		}
 	}
 }
diff --git a/packages/kit/src/runtime/server/page/actions.js b/packages/kit/src/runtime/server/page/actions.js
index eb5b7c187..1c1d554cc 100644
--- a/packages/kit/src/runtime/server/page/actions.js
+++ b/packages/kit/src/runtime/server/page/actions.js
@@ -248,5 +248,9 @@ function check_serializability(value, id, path) {
 		}
 	}
 
-	throw new Error(`${path} returned from action in ${id} cannot be serialized as JSON`);
+	throw new Error(
+		`${path} returned from action in ${id} cannot be serialized as JSON without losing its original type` +
+			// probably the most common case, so let's give a hint
+			(value instanceof Date ? ' (Date objects are serialized as strings)' : '')
+	);
 }
diff --git a/packages/kit/src/runtime/server/page/render.js b/packages/kit/src/runtime/server/page/render.js
index b26c4da88..7953d3301 100644
--- a/packages/kit/src/runtime/server/page/render.js
+++ b/packages/kit/src/runtime/server/page/render.js
@@ -177,7 +177,11 @@ export async function render_response({
 		// function, but it would mean passing more stuff around than we currently do
 		const error = /** @type {any} */ (e);
 		const match = /\[(\d+)\]\.data\.(.+)/.exec(error.path);
-		if (match) throw new Error(`${error.message} (data.${match[2]})`);
+		if (match) {
+			throw new Error(
+				`Data returned from \`load\` while rendering /${event.routeId} is not serializable: ${error.message} (data.${match[2]})`
+			);
+		}
 		throw error;
 	}
 
diff --git a/packages/kit/src/runtime/server/utils.js b/packages/kit/src/runtime/server/utils.js
index 08bc5437d..33ef9b7c0 100644
--- a/packages/kit/src/runtime/server/utils.js
+++ b/packages/kit/src/runtime/server/utils.js
@@ -67,8 +67,11 @@ export function allowed_methods(mod) {
 	return allowed;
 }
 
-/** @param {any} data */
-export function data_response(data) {
+/**
+ * @param {any} data
+ * @param {import('types').RequestEvent} event
+ */
+export function data_response(data, event) {
 	const headers = {
 		'content-type': 'application/json',
 		'cache-control': 'private, no-store'
@@ -79,7 +82,9 @@ export function data_response(data) {
 	} catch (e) {
 		const error = /** @type {any} */ (e);
 		const match = /\[(\d+)\]\.data\.(.+)/.exec(error.path);
-		const message = match ? `${error.message} (data.${match[2]})` : error.message;
+		const message = match
+			? `Data returned from \`load\` while rendering /${event.routeId} is not serializable: ${error.message} (data.${match[2]})`
+			: error.message;
 		return new Response(JSON.stringify(message), { headers, status: 500 });
 	}
 }
diff --git a/packages/kit/src/utils/filesystem.js b/packages/kit/src/utils/filesystem.js
index 8ddcc0c5c..1cd688186 100644
--- a/packages/kit/src/utils/filesystem.js
+++ b/packages/kit/src/utils/filesystem.js
@@ -6,7 +6,12 @@ export function mkdirp(dir) {
 	try {
 		fs.mkdirSync(dir, { recursive: true });
 	} catch (/** @type {any} */ e) {
-		if (e.code === 'EEXIST') return;
+		if (e.code === 'EEXIST') {
+			if (!fs.statSync(dir).isDirectory()) {
+				throw new Error(`Cannot create directory ${dir}, a file already exists at this position`);
+			}
+			return;
+		}
 		throw e;
 	}
 }
diff --git a/packages/kit/src/utils/url.js b/packages/kit/src/utils/url.js
index 1f658aac6..53d3b671d 100644
--- a/packages/kit/src/utils/url.js
+++ b/packages/kit/src/utils/url.js
@@ -103,10 +103,12 @@ export function make_trackable(url, callback) {
 		});
 	}
 
-	// @ts-ignore
-	tracked[Symbol.for('nodejs.util.inspect.custom')] = (depth, opts, inspect) => {
-		return inspect(url, opts);
-	};
+	if (!__SVELTEKIT_BROWSER__) {
+		// @ts-ignore
+		tracked[Symbol.for('nodejs.util.inspect.custom')] = (depth, opts, inspect) => {
+			return inspect(url, opts);
+		};
+	}
 
 	disable_hash(tracked);
 
diff --git a/packages/kit/src/utils/url.spec.js b/packages/kit/src/utils/url.spec.js
index 4c359b224..cc9201574 100644
--- a/packages/kit/src/utils/url.spec.js
+++ b/packages/kit/src/utils/url.spec.js
@@ -2,6 +2,9 @@ import * as assert from 'uvu/assert';
 import { describe } from './unit_test.js';
 import { resolve, normalize_path, make_trackable, disable_search } from './url.js';
 
+// @ts-expect-error define global required in url.js
+globalThis.__SVELTEKIT_BROWSER__ = false;
+
 describe('resolve', (test) => {
 	test('resolves a root-relative path', () => {
 		assert.equal(resolve('/a/b/c', '/x/y/z'), '/x/y/z');
diff --git a/packages/kit/types/internal.d.ts b/packages/kit/types/internal.d.ts
index 70e4b9706..80f82653d 100644
--- a/packages/kit/types/internal.d.ts
+++ b/packages/kit/types/internal.d.ts
@@ -375,5 +375,6 @@ declare global {
 	const __SVELTEKIT_APP_VERSION__: string;
 	const __SVELTEKIT_APP_VERSION_FILE__: string;
 	const __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: number;
+	const __SVELTEKIT_BROWSER__: boolean;
 	const __SVELTEKIT_DEV__: boolean;
 }


Test patch:
diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js
index 0588cdc6b..9331e7708 100644
--- a/packages/kit/test/apps/basics/test/test.js
+++ b/packages/kit/test/apps/basics/test/test.js
@@ -308,7 +308,7 @@ test.describe('Shadowed pages', () => {
 
 			expect(await page.textContent('h1')).toBe('500');
 			expect(await page.textContent('#message')).toBe(
-				'This is your custom error page saying: "Cannot stringify arbitrary non-POJOs (data.nope)"'
+				'This is your custom error page saying: "Data returned from `load` while rendering /shadowed/serialization is not serializable: Cannot stringify arbitrary non-POJOs (data.nope)"'
 			);
 		});
 	}
diff --git a/packages/kit/test/build-errors/prerender.spec.js b/packages/kit/test/build-errors/prerender.spec.js
index 3ddf2c352..209a3dd2b 100644
--- a/packages/kit/test/build-errors/prerender.spec.js
+++ b/packages/kit/test/build-errors/prerender.spec.js
@@ -11,7 +11,7 @@ test('prerenderable routes must be prerendered', () => {
 				stdio: 'pipe',
 				timeout: 15000
 			}),
-		/The following routes were marked as prerenderable, but were not prerendered:\r?\n  - \[x\]/gs
+		/The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\r?\n  - \[x\]/gs
 	);
 });