Repository: sveltejs/kit (js)

Issue:
Issue with `trailingSlash` and prerendered routes
### Describe the bug

I have a website with prerendered pages running via `adapter-node`. The problem is that users sometimes use trailing slash in URLs. In this case, the loaded page looks like it has no css loaded, but with the correct content. I would expect a redirect to the URL without a trailing slash. 

What is the expected behavior in this case?

https://sveltekit-trailing-slash.vercel.app/test

![Screenshot 2023-01-27 182023](https://user-images.githubusercontent.com/1249779/215152544-19faedac-aa39-4c8d-b642-5e42cf2138ef.png)


https://sveltekit-trailing-slash.vercel.app/test/

![Screenshot 2023-01-27 182012](https://user-images.githubusercontent.com/1249779/215152539-4ea1be39-5f5d-4e7a-8aec-073e57073e27.png)



### Reproduction

Demo: https://sveltekit-trailing-slash.vercel.app/

Repository: https://github.com/yellowby/sveltekit-trailing-slash

### Logs

_No response_

### System Info

```Shell
System:
    OS: Windows 10 10.0.22621
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 38.98 GB / 63.93 GB
  Binaries:
    Node: 18.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1105.0), Chromium (109.0.1518.69)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.2 => 1.0.2
    @sveltejs/adapter-node: ^1.1.4 => 1.1.4
    @sveltejs/kit: ^1.0.0 => 1.3.1
    svelte: ^3.54.0 => 3.55.1
    vite: ^4.0.0 => 4.0.4
```


### Severity

annoyance

### Additional Information

_No response_

Pull request description:
fix: add prerendered redirect for non-trailing slash routes with the Vercel adapter
fixes #8755

Adds a redirect for prerendered non-trailing slash routes to `adapter-vercel`.
Previously, only prerendered trailing slash routes would be added to the redirects list in the vercel config file.

### 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
- [x] 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. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.


Patch:
diff --git a/.changeset/purple-starfishes-sip.md b/.changeset/purple-starfishes-sip.md
new file mode 100644
index 000000000..1b10ffc07
--- /dev/null
+++ b/.changeset/purple-starfishes-sip.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/adapter-vercel': patch
+---
+
+fix: add trailing slash -> no trailing slash redirect for prerendered pages
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b08e334a2..df1e8e939 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -30,6 +30,14 @@ Entry points to be aware of are:
 - [`packages/kit/src/exports/vite`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/exports/vite) - for all the Vite plugin related stuff
 - [`packages/adapter-[platform]`](https://github.com/sveltejs/kit/tree/master/packages) - for the various SvelteKit-provided adapters
 
+## Good first issues
+
+If you're looking for an issue to tackle to get familiar with the codebase and test suite, the [**low hanging fruit**](https://github.com/sveltejs/kit/issues?q=is%3Aissue+is%3Aopen+label%3A%22low+hanging+fruit%22) label contains issues that ought to be relatively straightforward to fix. Check to see if a PR already exists for an issue before working on it!
+
+Issues that have a clear solution but which _may_ be slightly more involved have the [**ready to implement**](https://github.com/sveltejs/kit/issues?q=is%3Aissue+is%3Aopen+label%3A%22ready+to+implement%22) label.
+
+Issues with the [**soon**](https://github.com/sveltejs/kit/issues?q=is%3Aissue+is%3Aopen+milestone%3Asoon) milestone are higher priority than issues with the [**later**](https://github.com/sveltejs/kit/issues?q=is%3Aissue+is%3Aopen+milestone%3Alater+) label (though PRs for 'later' issues are still welcome, especially if you're affected by them).
+
 ## Testing
 
 Run `pnpm test` to run the tests from all subpackages. Browser tests live in subdirectories of `packages/kit/test` such as `packages/kit/test/apps/basics`.
@@ -58,15 +66,15 @@ If you would like to test local changes to Vite or another dependency, you can b
 
 ```jsonc
 {
-	// ...
-	"dependencies": {
-		"vite": "^3.1.0"
-	},
-	"pnpm": {
-		"overrides": {
-			"vite": "link:../path/to/vite/packages/vite"
-		}
-	}
+  // ...
+  "dependencies": {
+    "vite": "^4.0.0"
+  },
+  "pnpm": {
+    "overrides": {
+      "vite": "link:../path/to/vite/packages/vite"
+    }
+  }
 }
 ```
 
diff --git a/documentation/docs/20-core-concepts/20-load.md b/documentation/docs/20-core-concepts/20-load.md
index 7095cc22f..e865bcc34 100644
--- a/documentation/docs/20-core-concepts/20-load.md
+++ b/documentation/docs/20-core-concepts/20-load.md
@@ -417,6 +417,8 @@ export function load({ locals }) {
 
 > Make sure you're not catching the thrown redirect, which results in a noop.
 
+In the browser, you can also navigate programmatically outside of a `load` function using [`goto`](modules#$app-navigation-goto) from [`$app.navigation`](modules#$app-navigation).
+
 ## Promise unwrapping
 
 Top-level promises will be awaited, which makes it easy to return multiple promises without creating a waterfall:
diff --git a/documentation/docs/25-build-and-deploy/50-adapter-static.md b/documentation/docs/25-build-and-deploy/50-adapter-static.md
index d34bcc73b..0c688a506 100644
--- a/documentation/docs/25-build-and-deploy/50-adapter-static.md
+++ b/documentation/docs/25-build-and-deploy/50-adapter-static.md
@@ -137,7 +137,7 @@ export default {
 
 When operating in SPA mode, you can omit the [`prerender`](page-options#prerender) option from your root layout (or set it to `false`, its default value), and only pages that have the `prerender` option set will be prerendered at build time.
 
-SvelteKit will still crawl your app's entry points looking for prerenderable pages. If `svelte-kit build` fails because of pages that can't be loaded outside the browser, you can set `config.kit.prerender.entries` to `[]` to prevent this from happening. (Setting `config.kit.prerender.enabled` to `false` also has this effect, but would prevent the fallback page from being generated.)
+SvelteKit will still crawl your app's entry points looking for prerenderable pages. If `svelte-kit build` fails because of pages that can't be loaded outside the browser, you can set `config.kit.prerender.entries` to `[]` to prevent this from happening.
 
 You can also add turn off prerendering only to parts of your app, if you want other parts to be prerendered.
 
diff --git a/package.json b/package.json
index 6dd9a7d7e..c9236e32f 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
 		"tiny-glob": "^0.2.9",
 		"typescript": "^4.9.4"
 	},
-	"packageManager": "pnpm@7.26.1",
+	"packageManager": "pnpm@7.26.2",
 	"engines": {
 		"pnpm": "^7.0.0"
 	},
diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js
index 529225d7c..47d384ee3 100644
--- a/packages/adapter-vercel/index.js
+++ b/packages/adapter-vercel/index.js
@@ -193,16 +193,24 @@ function static_vercel_config(builder) {
 	}
 
 	for (const [path, page] of builder.prerendered.pages) {
-		if (path.endsWith('/') && path !== '/') {
+		let overrides_path = path.slice(1);
+
+		if (path !== '/') {
+			/** @type {string | undefined} */
+			let counterpart_route = path + '/';
+
+			if (path.endsWith('/')) {
+				counterpart_route = path.slice(0, -1);
+				overrides_path = path.slice(1, -1);
+			}
+
 			prerendered_redirects.push(
-				{ src: path, dest: path.slice(0, -1) },
-				{ src: path.slice(0, -1), status: 308, headers: { Location: path } }
+				{ src: path, dest: counterpart_route },
+				{ src: counterpart_route, status: 308, headers: { Location: path } }
 			);
-
-			overrides[page.file] = { path: path.slice(1, -1) };
-		} else {
-			overrides[page.file] = { path: path.slice(1) };
 		}
+
+		overrides[page.file] = { path: overrides_path };
 	}
 
 	return {
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index 1ccc0b796..d87a5b57d 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,11 @@
 # @sveltejs/kit
 
+## 1.3.3
+
+### Patch Changes
+
+- fix: forward `process.env` to child process ([#8777](https://github.com/sveltejs/kit/pull/8777))
+
 ## 1.3.2
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index f2ad02c66..1481491f1 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.3.2",
+	"version": "1.3.3",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/utils/fork.js b/packages/kit/src/utils/fork.js
index 1cffc54a3..58ed2dcb5 100644
--- a/packages/kit/src/utils/fork.js
+++ b/packages/kit/src/utils/fork.js
@@ -39,6 +39,7 @@ export function forked(module, callback) {
 			const child = child_process.fork(fileURLToPath(module), {
 				stdio: 'inherit',
 				env: {
+					...process.env,
 					SVELTEKIT_FORK: 'true'
 				},
 				serialization: 'advanced'
diff --git a/packages/kit/types/ambient.d.ts b/packages/kit/types/ambient.d.ts
index 8a8103795..474cd297b 100644
--- a/packages/kit/types/ambient.d.ts
+++ b/packages/kit/types/ambient.d.ts
@@ -237,7 +237,7 @@ declare module '$app/navigation' {
 	 * Programmatically imports the code for routes that haven't yet been fetched.
 	 * Typically, you might call this to speed up subsequent navigation.
 	 *
-	 * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about.svelte`) or `/blog/*` (to match `src/routes/blog/[slug].svelte`).
+	 * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about/+page.svelte`) or `/blog/*` (to match `src/routes/blog/[slug]/+page.svelte`).
 	 *
 	 * Unlike `preloadData`, this won't call `load` functions.
 	 * Returns a Promise that resolves when the modules have been imported.


Test patch:
diff --git a/packages/kit/test/apps/basics/test/server.test.js b/packages/kit/test/apps/basics/test/server.test.js
index 748253030..a375d7621 100644
--- a/packages/kit/test/apps/basics/test/server.test.js
+++ b/packages/kit/test/apps/basics/test/server.test.js
@@ -164,8 +164,7 @@ test.describe('Errors', () => {
 		expect(await response.text()).toMatch('PUT method not allowed');
 	});
 
-	// TODO re-enable this if https://github.com/vitejs/vite/issues/7046 is implemented
-	test.skip('error evaluating module', async ({ request }) => {
+	test('error evaluating module', async ({ request }) => {
 		const response = await request.get('/errors/init-error-endpoint');
 
 		expect(response.status()).toBe(500);