123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import { defineConfig, loadEnv, splitVendorChunkPlugin } from "vite";
- import react from "@vitejs/plugin-react";
- import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";
- // https://vitejs.dev/config/
- export default ({ mode }) =>
- defineConfig({
- // eslint-disable-next-line no-undef
- base: loadEnv(mode, process.cwd()).VITE_PUBLIC_DIR,
- server: {
- port: 3888,
- },
- plugins: [
- react({
- jsxImportSource: "@emotion/react",
- babel: {
- plugins: ["@emotion/babel-plugin"],
- },
- }),
- splitVendorChunkPlugin(),
- obfuscatorPlugin({
- apply: "build",
- options: {
- debugProtection: true,
- compact: true,
- controlFlowFlattening: true,
- controlFlowFlatteningThreshold: 0.75,
- deadCodeInjection: true,
- deadCodeInjectionThreshold: 0.4,
- debugProtectionInterval: 0,
- disableConsoleOutput: true,
- identifierNamesGenerator: "hexadecimal",
- log: false,
- numbersToExpressions: true,
- renameGlobals: false,
- selfDefending: true,
- simplify: true,
- splitStrings: true,
- splitStringsChunkLength: 10,
- stringArray: true,
- stringArrayCallsTransform: true,
- stringArrayCallsTransformThreshold: 0.75,
- stringArrayEncoding: ["base64"],
- stringArrayIndexShift: true,
- stringArrayRotate: true,
- stringArrayShuffle: true,
- stringArrayWrappersCount: 2,
- stringArrayWrappersChainedCalls: true,
- stringArrayWrappersParametersMaxCount: 4,
- stringArrayWrappersType: "function",
- stringArrayThreshold: 0.75,
- transformObjectKeys: true,
- unicodeEscapeSequence: false,
- },
- }),
- ],
- });
|