Quick Start
Creating a project
Run one of the following command Depend on what package manager you are using
PNPM first
Use pnpm as much as possible. It respects package version more than npm.
npm create @sveltepress@latest sh
Adding to an existing sveltekit project
Install vite plugin package
npm install --save @sveltepress/vite sh
Replace sveltekit plugin in vite.config.(js|ts)
vite.config.(js|ts)
-
+
-
+
import { } from '@sveltejs/kit/vite'
import { } from '@sveltepress/vite'
import { } from 'vite'
const = ({
: [
(),
(),
],
})
export default ts
Remove the original
sveltepress() already sets up SvelteKit for you. Keeping both sveltekit() and sveltepress() in plugins compiles every Svelte file twice and crashes the dev server with Expected token }.
Add '.md' extension to the extensions options in your svelte.config.js
svelte.config.js
-
+
import from '@sveltejs/adapter-static'
import { } from '@sveltejs/vite-plugin-svelte'
/**
* @type {import('@sveltejs/kit').Config}
*/
const = {
: ['.svelte'],
: ['.svelte', '.md'], // add .md here
: [()],
: {
: ({
: 'dist',
}),
},
}
export default ts
No
Projects scaffolded with a recent npx sv create keep their SvelteKit config inline in vite.config.ts and ship no svelte.config.js. Move those options into sveltepress({ svelteKitOptions }) (Sveltepress adds the '.md' extension for you automatically) and remove the standalone sveltekit() plugin:
vite.config.ts
import from '@sveltejs/adapter-auto'
import { } from '@sveltepress/vite'
import { } from 'vite'
export default ({
: [
({
: {
: {
: ({ }) =>
.(/[/\\]/).('node_modules') ? : true,
},
: (),
},
}),
],
}) ts