-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathvite.config.ts
More file actions
43 lines (39 loc) · 872 Bytes
/
vite.config.ts
File metadata and controls
43 lines (39 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { sveltekit } from '@sveltejs/kit/vite';
import { dirname, resolve } from 'path';
import { defineConfig, type UserConfig } from 'vite';
import { defineViteReplacements } from './vite.utils';
const config: UserConfig = {
plugins: [sveltekit()],
resolve: {
alias: {
$declarations: resolve('./src/declarations')
}
},
build: {
target: 'es2020',
rollupOptions: {
output: {
manualChunks: (id) => {
const folder = dirname(id);
if (
['@sveltejs', 'svelte', 'layercake', 'd3-'].find((lib) => folder.includes(lib)) ===
undefined &&
folder.includes('node_modules')
) {
return 'vendor';
}
return undefined;
}
}
}
},
worker: {
format: 'es'
}
};
export default defineConfig(
async ({ mode }): Promise<UserConfig> => ({
...config,
define: await defineViteReplacements({ mode })
})
);