-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.mts
49 lines (48 loc) · 1.24 KB
/
vite.config.mts
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
/// <reference types="vitest" />
/// <reference types="vite-plugin-svgr/client" />
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgrPlugin from 'vite-plugin-svgr';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), viteTsconfigPaths(), svgrPlugin()],
server: {
port: 3001,
},
publicDir: 'public',
build: {
outDir: 'build',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes("node_modules")) {
return 'vendor';
} else if (!id.includes("/src/ext/") && !id.includes("/i18n/translations/")) {
return 'index';
} else if (/\/src\/ext\/.+\/.+/.test(id) && !id.includes("__tests__")) {
const split = id.split("/src/ext/");
return `ext-${split[split.length - 1].split("/")[0]}`;
}
}
}
}
},
resolve: {
alias: [
// @ts-ignore
{
find: /^~.+/,
replacement: (val: any) => {
return val.replace(/^~/, "");
},
},
],
},
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/setupTests.js"],
},
});