In SvelteKit, I can't figure out a way to change the path of the actual build directory (not the app or the generated directory) via configuration. I've tried changing it in Vite configuration (1) but I get the message (2).
1.
// vite.config.ts
import { sveltekit } from "@sveltejs/kit/vite"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [ sveltekit() ],
build: { outDir: "builds" }
})
The following Vite config options will be overridden by SvelteKit:
- build.outDir
For context, I'm making a mono-repo for a cross-platform app with the Vite generated SvelteKit build as a basis for the native platform apps.
With help from Patrick of the Svelte Discord I learned the correct configuration is the pages
key in the adapter options (documentation.)
// svelte.config.js
import adapter from "@sveltejs/adapter-static"
import { vitePreprocess } from "@sveltejs/kit/vite"
/** @type {import("@sveltejs/kit").Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter({ pages: "builds" })
}
}
export default config