-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
56 lines (55 loc) · 1.46 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
import * as path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import sunmaoFsVitePlugin from './tools/sunmao-fs-vite-plugin';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import { fileURLToPath } from 'url';
// https://vitejs.dev/config/
export default defineConfig({
server: {
watch: {
ignored: [path.resolve(__dirname, './src/sunmao/*.json')],
},
},
build: {
rollupOptions: {
input: {
index: fileURLToPath(new URL('./index.html', import.meta.url)),
dev: fileURLToPath(new URL('./dev.html', import.meta.url)),
},
},
},
define: {
// react-codemirror2 need this
global: 'globalThis',
},
plugins: [
sunmaoFsVitePlugin({
schemas: [
{
name: 'site',
path: path.resolve(__dirname, './src/sunmao/site.json'),
},
{
name: 'calendar',
path: path.resolve(__dirname, './src/sunmao/calendar.json'),
},
{
name: 'table',
path: path.resolve(__dirname, './src/sunmao/table.json'),
},
{
name: 'only-calendar',
path: path.resolve(__dirname, './src/sunmao/only-calendar.json'),
},
],
}),
react(),
createSvgIconsPlugin({
// Specify the icon folder to be cached
iconDirs: [path.resolve(__dirname, 'public/icons')],
// Specify symbolId format
symbolId: 'icon-[name]',
}),
],
});