import { defineConfig } from 'vite' import obfuscatorPlugin from "vite-plugin-javascript-obfuscator"; import { resolve } from 'path' export default defineConfig(({ command, mode }) => { return { build: { target: 'modules', sourcemap: false, rollupOptions: { input: { entrance: resolve(__dirname, 'index.html'), index: resolve(__dirname, 'pages/index/index.html'), login: resolve(__dirname, 'pages/login/index.html'), }, }, }, plugins: [ obfuscatorPlugin({ apply: config => config['mode'] === 'build', 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, } }) ] } })