forked from biggerstar/wedecode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
75 lines (71 loc) · 1.33 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {resolve} from 'node:path';
import {cwd} from 'node:process'
import copy from "rollup-plugin-copy";
import {defineConfig} from "vite";
const external = [
'commander',
'css-tree',
'cheerio',
'cssbeautify',
'escodegen',
'esprima',
'handlebars',
'js-beautify',
'uglify-js',
'vite',
'fs-extra',
'vm2',
'node:path',
'node:process',
'node:child_process',
'node:module',
'node:fs',
'node:crypto',
'picocolors',
'jsdom',
'glob',
'inquirer',
'inquirer/*',
'figlet',
'figlet',
'figures',
'update-check',
'open-file-explorer',
'@biggerstar/inquirer-selectable-table',
]
export default defineConfig( {
resolve: {
extensions: [".ts", ".js", '.tsx', '.mjs'],
alias: {
"@": resolve(cwd(), 'src'),
types: resolve(cwd(), 'src/types')
}
},
build: {
emptyOutDir: false,
minify: false,
outDir: resolve(cwd(), 'dist'),
rollupOptions: {
external,
output: {
sourcemap: false,
globals: {}
},
treeshake: true
},
lib: {
entry: resolve(cwd(), './src/bin/wedecode/wedecode.ts'),
formats: ['es'],
name: 'wedecode',
fileName: () => 'wedecode.js',
},
},
plugins: [
copy({
targets: [
// 复制内置 polyfill
{ src: 'src/polyfill', dest: 'dist' },
]
}),
]
})