-
-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathvite.config.js
More file actions
60 lines (58 loc) · 1.27 KB
/
Copy pathvite.config.js
File metadata and controls
60 lines (58 loc) · 1.27 KB
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
54
55
56
57
58
59
60
import { defineConfig } from 'vite';
import path from 'path';
export default defineConfig(({ mode }) => {
if (mode === 'example') {
return {
root: 'examples',
base: './',
build: {
outDir: '../docs-dist',
emptyOutDir: false,
rollupOptions: {
input: path.resolve(__dirname, 'examples/example.html'),
output: {
entryFileNames: 'example.js',
},
},
},
};
}
return {
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.js'),
name: 'chartXkcd',
formats: ['umd', 'es'],
fileName: (format) => {
if (format === 'umd') {
return 'chart.xkcd.min.js';
}
return 'index.js';
},
},
outDir: 'dist',
minify: 'terser',
terserOptions: {
compress: {
passes: 3,
drop_console: true,
drop_debugger: true,
pure_getters: true,
unsafe: true,
unsafe_arrows: true,
unsafe_methods: true,
},
mangle: {
toplevel: true,
properties: {
regex: '^_',
},
},
format: {
comments: false,
},
},
sourcemap: false,
},
};
});