Skip to content

Commit 1dabaea

Browse files
committed
Refactor Svelte config to external file
1 parent e753c76 commit 1dabaea

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

svelte.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { sveltePreprocess } from 'svelte-preprocess';
2+
3+
/** @type {import('@sveltejs/vite-plugin-svelte').SvelteConfig} */
4+
export default {
5+
preprocess: sveltePreprocess(),
6+
compilerOptions: {
7+
runes: true,
8+
},
9+
};

vite.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { cp, mkdir, readFile, writeFile } from 'fs/promises';
44
import path from 'path';
55

66
import { svelte } from '@sveltejs/vite-plugin-svelte';
7-
import { sveltePreprocess } from 'svelte-preprocess';
87
import { createGenerator } from 'ts-json-schema-generator';
98
import { defineConfig } from 'vite';
109

10+
import svelteConfig from './svelte.config';
11+
1112
/**
1213
* Path to the generated public type declaration file.
1314
*/
@@ -185,11 +186,8 @@ export default defineConfig({
185186
esbuild: { legalComments: 'eof' },
186187
plugins: [
187188
svelte({
189+
...svelteConfig,
188190
emitCss: false,
189-
preprocess: sveltePreprocess(),
190-
compilerOptions: {
191-
runes: true,
192-
},
193191
}),
194192
copyPackageFiles(),
195193
generateExtraFiles(),

0 commit comments

Comments
 (0)