Skip to content

Commit fc13799

Browse files
authored
Migrate to latest version of SvelteKit (#98)
* migration part 1 - vite, renamed files * solve migration tasks * remove obsolete _ shenanigans * bump site-kit * migrate tutorial apps * update text
1 parent de91588 commit fc13799

File tree

54 files changed

+551
-526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+551
-526
lines changed

content/tutorial/02-sveltekit/02-routing/01-pages/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Pages
33
---
44

5-
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.
5+
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.
66

7-
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.
7+
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.
88

99
> 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.
1010
11-
Let's add a link in `src/routes/about.svelte` back to the homepage:
11+
Let's add a link in `src/routes/about/+page.svelte` back to the homepage:
1212

1313
```svelte
1414
<p>This is the about page.</p>

content/tutorial/04-advanced-sveltekit/01-todo/01-sandbox/app-a/svelte.config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import adapter from '@sveltejs/adapter-auto';
33
/** @type {import('@sveltejs/kit').Config} */
44
const config = {
55
kit: {
6-
adapter: adapter(),
7-
8-
vite: {
9-
optimizeDeps: {
10-
include: ['cjs-dep']
11-
}
12-
}
6+
adapter: adapter()
137
}
148
};
159

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('vite').UserConfig} */
2+
export default {
3+
optimizeDeps: {
4+
include: ['cjs-dep']
5+
}
6+
};

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
"name": "learn.svelte.dev",
33
"version": "0.0.1",
44
"scripts": {
5-
"dev": "svelte-kit dev",
6-
"build": "node scripts/create-common-bundle && svelte-kit build && node scripts/create-middleware",
7-
"package": "svelte-kit package",
8-
"preview": "svelte-kit preview",
9-
"prepare": "svelte-kit sync",
5+
"dev": "vite dev",
6+
"build": "node scripts/create-common-bundle && vite build && node scripts/create-middleware",
7+
"preview": "vite preview",
108
"check": "svelte-check --tsconfig ./jsconfig.json",
119
"check:watch": "svelte-check --tsconfig ./jsconfig.json --watch",
1210
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
@@ -15,15 +13,16 @@
1513
"devDependencies": {
1614
"@sveltejs/adapter-auto": "next",
1715
"@sveltejs/kit": "next",
18-
"@sveltejs/site-kit": "^2.1.0",
16+
"@sveltejs/site-kit": "^2.1.2",
1917
"diff": "^5.1.0",
2018
"esbuild": "^0.14.43",
2119
"prettier": "^2.6.2",
2220
"prettier-plugin-svelte": "^2.7.0",
2321
"svelte": "^3.48.0",
2422
"svelte-check": "^2.7.2",
2523
"tiny-glob": "^0.2.9",
26-
"typescript": "~4.6.4"
24+
"typescript": "~4.6.4",
25+
"vite": "^3.1.3"
2726
},
2827
"type": "module",
2928
"dependencies": {

0 commit comments

Comments
 (0)