-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
45 lines (44 loc) · 1.13 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
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
import createSvgSpritePlugin from 'vite-plugin-svg-sprite';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
import packageJson from './package.json';
// https://vitejs.dev/config/
export default defineConfig(() => ({
base: packageJson.homepage,
define: {
'import.meta.env.VITE_NAME': JSON.stringify(packageJson.name),
'import.meta.env.VITE_VERSION': JSON.stringify(packageJson.version),
},
plugins: [
tsconfigPaths(),
react(),
svgr(),
createSvgSpritePlugin({
symbolId: 'sprite-icon-[name]-[hash]',
}),
ViteEjsPlugin(viteConfig => ({
// viteConfig is the current Vite resolved config
env: viteConfig.env,
})),
],
build: {
outDir: packageJson.buildFolderName,
sourcemap: true,
target: 'esnext',
},
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
// Node.js global to browser globalThis
define: {
global: 'globalThis',
},
},
},
server: {
open: true,
},
}));