forked from tanhauhau/svelte-json-tree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
45 lines (42 loc) · 972 Bytes
/
vite.config.js
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
import path from 'path';
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
const STANDALONE = !!process.env.STANDALONE;
let outDir,
fileName,
formats,
rollupOptions = {};
if (STANDALONE) {
outDir = 'package/dist/standalone';
fileName = (format) => `${format}/index.js`;
formats = ['umd', 'es', 'cjs'];
} else {
outDir = 'package/dist';
fileName = (format) => `${format}/index.js`;
formats = ['es', 'cjs'];
rollupOptions = {
external: [
'svelte',
'svelte/animate',
'svelte/easing',
'svelte/internal',
'svelte/motion',
'svelte/store',
'svelte/transition',
'svelte/ssr',
],
};
}
export default defineConfig({
build: {
outDir,
lib: {
entry: path.resolve('package/index.js'),
name: 'SvelteJsonTree',
fileName,
formats,
},
rollupOptions,
},
plugins: [svelte({ extensions: ['.svelte'], emitCss: false })],
});