forked from vega/editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
54 lines (48 loc) · 1.12 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
import react from '@vitejs/plugin-react';
import childProcess from 'child_process';
import type {UserConfig} from 'vite';
const commitHash = childProcess.execSync('git rev-parse --short HEAD').toString();
import type {PluginOption} from 'vite';
function watchNodeModules(modules: string[]): PluginOption {
return {
name: 'watch-node-modules',
config() {
return {
server: {
watch: {
ignored: modules.map((m) => `!**/node_modules/${m}/**`),
},
},
optimizeDeps: {
exclude: modules,
},
};
},
};
}
const config: UserConfig = {
base: '/editor/',
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
plugins: [
react(),
watchNodeModules([
'vega-lite',
'vega',
'vega-scale',
'vega-embed',
'vega-schema-url-parser',
'vega-themes',
'vega-tooltip',
]),
],
resolve: {
preserveSymlinks: true,
alias: {
'vega-lite/build/vega-lite-schema.json': 'vega-lite/build/vega-lite-schema.json',
'vega-lite': 'vega-lite/src/index.ts',
},
},
};
export default config;