Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions content/tutorial/02-sveltekit/02-routing/01-pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Pages
---

SvelteKit uses filesystem-based routing, which means that the _routes_ of your app — in other words, what the app should do when a user navigates to a particular URL — follow the same structure as your source code.
SvelteKit uses filesystem-based routing, which means that the _routes_ of your app — in other words, what the app should do when a user navigates to a particular URL — are defined by the directories in your codebase.

In this app we have two routes — `src/routes/index.svelte`, which maps to `/`, and `src/routes/about.svelte`, which maps to `/about`. Clicking the `about` link will take you from the home page to the about page.
In this app we have two routes — `src/routes/+page.svelte`, which maps to `/`, and `src/routes/about/+page.svelte`, which maps to `/about`. Clicking the `about` link will take you from the home page to the about page.

> Unlike traditional multi-page apps, navigating to `/about` updates the contents of the current page, like a single-page app. This gives us the best of both worlds — fast server-rendered startup, then instant navigation.

Let's add a link in `src/routes/about.svelte` back to the homepage:
Let's add a link in `src/routes/about/+page.svelte` back to the homepage:

```svelte
<p>This is the about page.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),

vite: {
optimizeDeps: {
include: ['cjs-dep']
}
}
adapter: adapter()
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('vite').UserConfig} */
export default {
optimizeDeps: {
include: ['cjs-dep']
}
};
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
"name": "learn.svelte.dev",
"version": "0.0.1",
"scripts": {
"dev": "svelte-kit dev",
"build": "node scripts/create-common-bundle && svelte-kit build && node scripts/create-middleware",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"prepare": "svelte-kit sync",
"dev": "vite dev",
"build": "node scripts/create-common-bundle && vite build && node scripts/create-middleware",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-check --tsconfig ./jsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
Expand All @@ -15,15 +13,16 @@
"devDependencies": {
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@sveltejs/site-kit": "^2.1.0",
"@sveltejs/site-kit": "^2.1.2",
"diff": "^5.1.0",
"esbuild": "^0.14.43",
"prettier": "^2.6.2",
"prettier-plugin-svelte": "^2.7.0",
"svelte": "^3.48.0",
"svelte-check": "^2.7.2",
"tiny-glob": "^0.2.9",
"typescript": "~4.6.4"
"typescript": "~4.6.4",
"vite": "^3.1.3"
},
"type": "module",
"dependencies": {
Expand Down
Loading