@fox-js/vite-plugin-js-obfuscator
TypeScript icon, indicating that this package has built-in type declarations

4.0.1-0 • Public • Published

Fox vite-plugin-js-obfuscator

js文件混淆插件,基于javascript-obfuscator开发

Install

NPM

npm i @fox-js/vite-plugin-js-obfuscator javascript-obfuscator -D

YARN

yarn add @fox-js/vite-plugin-js-obfuscator javascript-obfuscator -D

PNPM

pnpm add @fox-js/vite-plugin-js-obfuscator javascript-obfuscator -D

使用指南

import { UserConfigExport, ConfigEnv, loadEnv } from 'vite'
import jsObfuscator from '@fox-js/vite-plugin-js-obfuscator'
import { join } from 'path'

export default ({ command, mode }: ConfigEnv): UserConfigExport => {
  return {
    plugins: [
       jsObfuscator({
        globalOptions: prodMode ? {} : false,
        fileOptions: prodMode ? {} : false
      }),
    ]
  }
}

插件参数类型

export interface VitePluginObfuscatorOptions {
    /**
     * Global options, applied when rendering chunks. Pass `false` to disable.
     */
    globalOptions: ObfuscatorOptions | false;
    /**
     * Per-file options, applied when transforming files, include/exclude works for this option. Pass `false` to disable.
     */
    fileOptions: ObfuscatorOptions | false;
    /**
     * match
     * 是否对文件进行混淆,返回false不处理
     */
    match: {
        (path: string): boolean;
    };
}
/**
 * model name plugin工厂
 * @param options
 * @returns
 */
declare function jsObfuscatorPlugin(options?: Partial<VitePluginObfuscatorOptions>): Plugin;

Readme

Keywords

Package Sidebar

Install

npm i @fox-js/vite-plugin-js-obfuscator

Weekly Downloads

9

Version

4.0.1-0

License

none

Unpacked Size

6.38 kB

Total Files

6

Last publish

Collaborators

  • archlizz
  • jiangcheng316