-
Notifications
You must be signed in to change notification settings - Fork 10
/
vite.config.ts
48 lines (45 loc) · 1.05 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
import react from '@vitejs/plugin-react';
import fixReactVirtualized from 'esbuild-plugin-react-virtualized';
import { viteEnvs } from 'vite-envs';
import tsconfigPaths from 'vite-tsconfig-paths';
export default {
optimizeDeps: {
esbuildOptions: {
plugins: [fixReactVirtualized],
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
build: {
outDir: 'build',
},
server: {
port: 3000,
},
plugins: [
react(),
tsconfigPaths(),
viteEnvs({
declarationFile: '.env',
computedEnv: async () => {
const path = await import('path');
const fs = await import('fs/promises');
const packageJson = JSON.parse(
await fs.readFile(path.resolve(__dirname, 'package.json'), 'utf-8'),
);
// Here you can define any arbitrary values they will be available
// in `import.meta.env` and it's type definitions.
// You can also compute defaults for variable declared in `.env` files.
return {
VITE_NAME: packageJson.name,
VITE_VERSION: packageJson.version,
};
},
}),
],
};