-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvite.config.js
More file actions
66 lines (65 loc) · 2 KB
/
vite.config.js
File metadata and controls
66 lines (65 loc) · 2 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {resolve} from "path";
import { defineConfig } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import react from "@vitejs/plugin-react";
import dynamicImport from "vite-plugin-dynamic-import";
import eslintPlugin from "vite-plugin-eslint";
export default defineConfig({
// Specify the path at which the application will be deployed on a server. The path MUST end with "/".
// To deploy at the root path, use "/" or remove the "base" property entirely.
envPrefix: "REACT_",
plugins: [
react(),
eslintPlugin(),
dynamicImport(/* options */),
nodePolyfills({
// include polyfills for the modules that Vite/Rollup warns about
include: ["events", "timers", "fs"],
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"@components": resolve(__dirname, "./src/components"),
"@config": resolve(__dirname, "./src/config"),
"@context": resolve(__dirname, "./src/context"),
"@consts": resolve(__dirname, "./src/consts"),
"@models": resolve(__dirname, "./src/models"),
"@util": resolve(__dirname, "./src/util"),
},
},
build: {
// default chunk size limit is 500, but that's nearly impossible due to large JSON files
chunkSizeWarningLimit: 2000,
// specify rollup options to enable multiple entry points and break chunks up to smaller sizes
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
launch: resolve(__dirname, "launch.html"),
},
output: {
manualChunks: (id) => {
if (id.includes("node_modules")) {
return "vendor";
}
},
},
},
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/setupTests.js",
css: true,
reporters: ["verbose"],
coverage: {
reporter: ["text", "json", "html"],
include: ["src/**/*"],
},
},
esbuild: {
supported: {
"top-level-await": true, //browsers can handle top-level-await features
},
},
});