-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
65 lines (63 loc) · 1.75 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { defineConfig } from 'vite'
const watcherConfig = {
usePolling: true,
include: [
'src/**',
],
buildDelay: 800,
chokidar: {
usePolling: true,
interval: 300,
}
}
/** @type {import ('vite/dist/node/config')} */
export default defineConfig({
build: {
target: 'esnext',
outDir: 'dist',
chunkSizeWarningLimit: 2048,
emptyOutDir: true,
minify: 'esbuild',
watch: watcherConfig,
lib: {
entry: 'src/index.ts',
name: '{{package.name}}',
fileName: (format) => {
const map = {
umd: 'umd.cjs',
cjs: 'cjs',
es: 'js',
esm: 'js',
};
const suffix = map[format] ?? map.esm;
return `index.${suffix}`;
},
formats: ['es', 'umd', 'cjs'],
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [],
output: {
format: 'umd',
dir: 'dist',
exports: 'auto',
fileName: '{{package.name}}.umd.cjs',
globals: { // Provide global variables to use in the UMD build for externalized deps
vue: 'Vue',
react: 'React',
axios: 'axios',
},
},
watch: watcherConfig,
},
},
server: {
watch: {
...watcherConfig,
ignored: [
'**/vendor/**', './public/**', './app/**', './storage/**', '.git/**', './node_modules/**',
],
},
},
})