-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.ts
29 lines (26 loc) · 762 Bytes
/
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { readdirSync } from 'fs';
import legacy from '@vitejs/plugin-legacy';
const absolutePathAliases: { [key: string]: string } = {};
// Root resources folder
const srcPath = path.resolve('./');
const srcRootContent = readdirSync(srcPath, { withFileTypes: true }).map((dirent) => dirent.name.replace(/(\.ts|\.js)(x?)/, ''));
srcRootContent.forEach((directory) => {
absolutePathAliases[directory] = path.join(srcPath, directory);
});
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
...absolutePathAliases
}
},
plugins: [
legacy({
targets: ['Chrome 69']
}),
react()
]
});