import { defineConfig } from 'vite'; import obfuscatorPlugin from 'vite-plugin-javascript-obfuscator'; import { node } from 'vite-plugin-node'; import dts from 'vite-plugin-dts'; export default defineConfig({ plugins: [ // node(), dts(), obfuscatorPlugin({ include: ["dist/tsbuild/**/*.js"], exclude: [/node_modules/], apply: "build", debugger: true, options: { debugProtection:false, debugProtectionInterval:0, // ... [See more options](https://github.com/javascript-obfuscator/javascript-obfuscator) compact: true, controlFlowFlattening: false, controlFlowFlatteningThreshold: 0.5, deadCodeInjection: false, deadCodeInjectionThreshold: 0.2, disableConsoleOutput: true, identifierNamesGenerator: 'hexadecimal', log: false, renameGlobals: false, rotateStringArray: true, selfDefending: false, stringArray: true, stringArrayEncoding: ['base64'], stringArrayThreshold: 0.5, transformObjectKeys: false, unicodeEscapeSequence: false }, }), ], build: { lib: { entry: 'dist/tsbuild/index.js', // 入口文件 name: '@fmode/server', fileName: (format) => `fmode.${format}.js` }, rollupOptions: { input: 'dist/tsbuild/index.js', // 你的入口文件 output: { dir: 'dist/vitebuild', format: 'cjs' } } } });