-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
45 lines (41 loc) · 1.36 KB
/
vite.config.ts
File metadata and controls
45 lines (41 loc) · 1.36 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
import { PluginOption, defineConfig, loadEnv } from 'vite';
import obfuscatorPlugin from 'vite-plugin-javascript-obfuscator';
const isProduction = process.env.NODE_ENV == 'production';
const fullReloadAlways: PluginOption = {
handleHotUpdate({ server }) {
server.ws.send({ type: "full-reload" });
}
} as PluginOption
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
root: './src',
build: {
outDir: '../dist',
minify: true,
emptyOutDir: true,
},
json: {
stringify: true
},
plugins: [
...(isProduction ? [
obfuscatorPlugin({
include: ['src/js/**/*.js'],
exclude: [/node_modules/],
options: {
controlFlowFlattening: true,
deadCodeInjection: true,
debugProtection: true,
disableConsoleOutput: true,
numbersToExpressions: true,
// renameProperties: true, //! May break Alpine
// selfDefending: true //! May break Alpine
}
})
] : [
fullReloadAlways
]),
],
})
};