Spaces:
Running
Running
File size: 1,603 Bytes
16e3470 431ee5b 16e3470 c9eaf4f 431ee5b c9eaf4f 431ee5b f454dd0 431ee5b f454dd0 431ee5b f454dd0 431ee5b |
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 |
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import obfuscator from 'rollup-plugin-obfuscator'; // Import plugin
export default defineConfig({
server: {
allowedHosts: ['twanapi-testupload.hf.space'],
host: '0.0.0.0',
port: 5173,
},
plugins: [
react(),
// Chỉ chạy obfuscator khi build production
obfuscator({
global: true, // Áp dụng cho tất cả file
options: {
// Cấu hình làm rối code cực mạnh
compact: true,
controlFlowFlattening: true, // Làm rối luồng logic if/else
controlFlowFlatteningThreshold: 1,
deadCodeInjection: true, // Chèn code giả vào để đánh lừa
deadCodeInjectionThreshold: 0.4,
debugProtection: true, // Chống bật F12 console debug
debugProtectionInterval: 4000, // Treo trình duyệt nếu cố debug
disableConsoleOutput: true, // Chặn mọi console.log
identifierNamesGenerator: 'hexadecimal', // Đổi tên biến thành mã hex (0x...)
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true, // Code tự bảo vệ khi bị format lại
stringArray: true,
stringArrayEncoding: ['rc4'], // Mã hóa chuỗi text
stringArrayThreshold: 1,
unicodeEscapeSequence: false
},
}),
],
esbuild: {
drop: ['console', 'debugger'],
},
build: {
sourcemap: false,
minify: 'esbuild',
rollupOptions: {
output: {
manualChunks: undefined,
}
}
},
});
|