1
0

feat(frontend): 增加一点混淆

This commit is contained in:
2024-11-20 12:47:50 +08:00
parent 50068873a4
commit 94db7b510f
5 changed files with 694 additions and 4 deletions

View File

@@ -1,18 +1,41 @@
import { defineConfig } from 'vite'
import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";
import { resolve } from 'path'
export default defineConfig(({ comand, mode }) => {
export default defineConfig(({ command, mode }) => {
return {
build: {
target: 'modules',
sourcemap: false,
rollupOptions: {
input: {
entrence: resolve(__dirname, 'index.html'),
entrance: resolve(__dirname, 'index.html'),
index: resolve(__dirname, 'pages/index/index.html'),
login: resolve(__dirname, 'pages/login/index.html'),
},
},
},
plugins: [
obfuscatorPlugin({
options: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
renameGlobals: false,
stringArrayRotate: true,
selfDefending: true,
stringArray: true,
stringArrayEncoding: ['base64'],
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false,
}
})
]
}
})