This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
60 lines (56 loc) · 1.89 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
49
50
51
52
53
54
55
56
57
58
59
60
// / <reference types="vitest" />
// noinspection JSUnusedGlobalSymbols
import react from "@vitejs/plugin-react";
import { createHtmlPlugin } from "vite-plugin-html";
import vitePluginString from "vite-plugin-string";
import { defineConfig } from "vite";
// noinspection JSClassNamingConvention,JSUnusedLocalSymbols
declare interface process {
env: {
VITEST: boolean;
NODE_ENV: "development" | "prod" | "test";
};
}
const inDebug = !process.env.VITEST && process.env.NODE_ENV === "development";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
vitePluginString({
include: ["**/*.xsd"]
}),
!process.env.VITEST &&
createHtmlPlugin({
minify: true,
template: "index.html",
inject: {
data: {
reactDevTools: inDebug
? '<script src="http://localhost:8097"></script>'
: "",
// This patch is used bc the websocket stuff looks
// for a variable called global and expects the window
// to be there; in production we don't have to worry about it though.
reduxDevToolsPatch: inDebug
? "<script>var global = global || window;</script>"
: ""
}
}
})
],
envPrefix: "NODE_",
// Im going gorbo mode
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
test: {
setupFiles: ["./test/Setup.ts"],
environment: "jsdom",
deps: {
inline: ["monaco-editor"]
},
// Monaco is the bane of my existence.
alias: {
"monaco-editor": "monaco-editor/monaco.d.ts"
}
}
});