-
Notifications
You must be signed in to change notification settings - Fork 6
/
vite.config.ts
45 lines (42 loc) · 1.14 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
/* eslint-disable import/no-anonymous-default-export */
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
import eslint from 'vite-plugin-eslint';
export default ({ mode }) => {
// Load app-level env vars to node-level env vars.
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
define: {
'process.env': process.env,
},
resolve: {
alias: {
'~styles': path.resolve(__dirname, './src/assets/styles'),
'~hds-design-tokens': path.resolve(
__dirname,
'./node_modules/hds-design-tokens'
),
},
},
build: {
outDir: 'build',
},
server: {
port: parseInt(process.env.PORT) || 3000,
open: true,
},
preview: {
port: parseInt(process.env.PORT) || 3000,
},
plugins: [
react(),
eslint(),
viteTsconfigPaths(),
// svgr options: https://react-svgr.com/docs/options/
svgr({ svgrOptions: { icon: true } }),
],
});
};