-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
66 lines (64 loc) · 1.77 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
import { resolve } from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import checker from 'vite-plugin-checker'
import typescript from '@rollup/plugin-typescript'
export default defineConfig(({ mode }) => {
const isClient = process.argv.includes('-r')
return {
base: isClient ? '/uicons.js/' : undefined,
plugins:
mode === 'development' || isClient
? [
react(),
checker({
overlay: {
initialIsOpen: false,
},
typescript: {
tsconfigPath: resolve(__dirname, 'tsconfig.json'),
},
}),
]
: [],
build: {
target: ['safari11.1', 'chrome64', 'firefox66', 'edge88'],
outDir: isClient
? resolve(__dirname, './dist-web')
: resolve(__dirname, './dist'),
sourcemap: isClient ? false : false,
minify: isClient ? 'esbuild' : false,
input:
mode === 'development' || isClient
? { main: resolve(__dirname, 'index.html') }
: undefined,
lib:
mode === 'development' || isClient
? undefined
: {
name: 'uicons.js',
entry: 'src/index.ts',
fileName: (format, entry) => `${entry}.${format === 'cjs' ? 'cjs' : 'mjs'}`,
formats: ['es', 'cjs'],
},
rollupOptions:
mode === 'development' || isClient
? {
external: [],
}
: {
plugins: [typescript({ tsconfig: './tsconfig.json' })],
},
assetsDir: '',
emptyOutDir: true,
},
server: {
host: '0.0.0.0',
open: true,
port: 3001,
fs: {
strict: false,
},
},
}
})