-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathvite.config.ts
53 lines (50 loc) · 1.14 KB
/
vite.config.ts
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
44
45
46
47
48
49
50
51
52
53
import { sveltekit } from '@sveltejs/kit/vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { defineConfig } from 'vite';
import process from 'node:process';
const BUILD_MODE = process.env.BUILD_MODE;
let config;
if (BUILD_MODE === 'standalone') {
config = defineConfig({
build: {
outDir: 'dist/standalone',
lib: {
entry: 'dist/lib/index.js',
name: 'SvelteJsonTree',
fileName: (format) => `${format}/index.js`,
formats: ['umd', 'es'],
},
},
plugins: [svelte({ extensions: ['.svelte'], emitCss: false })],
});
} else if (BUILD_MODE === 'bundled') {
config = defineConfig({
build: {
outDir: 'dist/esm',
lib: {
entry: 'dist/lib/index.js',
name: 'SvelteJsonTree',
fileName: 'index',
formats: ['es'],
},
rollupOptions: {
external: [
'svelte',
'svelte/animate',
'svelte/easing',
'svelte/internal',
'svelte/motion',
'svelte/store',
'svelte/transition',
'svelte/ssr',
],
},
},
plugins: [svelte({ extensions: ['.svelte'], emitCss: false })],
});
} else {
config = defineConfig({
plugins: [sveltekit()]
});
}
export default config;