-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
79 lines (78 loc) · 2.3 KB
/
vite.config.js
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
67
68
69
70
71
72
73
74
75
76
77
78
79
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import obfuscator from "rollup-plugin-obfuscator";
import { uglify } from "rollup-plugin-uglify";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
publicDir: path.resolve(__dirname, "packages", "frontend", "public"),
base: "./",
root: path.resolve(__dirname, "./packages/frontend"),
server: {
open: false,
port: process.env.PORT || 8080,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./packages/frontend/src"),
},
},
optimizeDeps: {
exclude: ["electron-store"],
},
build: {
sourcemap: false,
outDir: path.join(__dirname, "Built App", "frontend"),
emptyOutDir: true,
minify: "terser",
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`,
plugins: [
uglify({
sourcemap: false,
}),
obfuscator({
fileOptions: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
numbersToExpressions: true,
simplify: true,
stringArrayShuffle: true,
stringArrayThreshold: 1,
rotateStringArray: true,
stringArray: true,
disableConsoleOutput: true,
deadCodeInjection: true,
debugProtection: true,
debugProtectionInterval: 2000,
selfDefending: true,
sourceMap: false,
},
globalOptions: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
numbersToExpressions: true,
simplify: true,
stringArrayShuffle: true,
stringArrayThreshold: 1,
rotateStringArray: true,
stringArray: true,
disableConsoleOutput: true,
deadCodeInjection: true,
debugProtection: true,
debugProtectionInterval: 2000,
selfDefending: true,
sourceMap: false,
},
}),
],
},
},
},
});