Updating from @sveltejs/kit@1.0.0-next.350 to @sveltejs/kit@1.0.0-next.403
TLDR: Here's the commit that I made all code changes in
I recently updated the version of sveltekit I'm using for qr-gen, and it was quite the experience :). There's not much documentation out there (at least that I could find), so I'm documenting what I needed to change here.
Update dependencies
yarn add @sveltejs/kit@latest @sveltejs/adapter-auto@latest --exact
Note: if you're using any other packages under the @sveltejs
org, you'll likely need to update those as well.
Add vite.config.js
Next, I needed to create vite.config.js
in the root of the repo and add the svelte-kit plugin to the config:
import {sveltekit} from '@sveltejs/kit/vite'
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
}
export default config
You'll also need to remove any configuration you have under the kit.vite
property in svelte.config.js
. Consulting the vite configuration docs should be helpful here.
Update API Routes to Use Uppercase Method Names
Updating export const post
to export const POST
(and so forth for other request methods)
If you liked this article and think others should read it, please share it on Twitter!