JSPM

vite-plugin-javascript-obfuscator

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14817
  • Score
    100M100P100Q154033F
  • License MIT

A Vite Plugin for javascript-obfuscator

Package Exports

  • vite-plugin-javascript-obfuscator
  • vite-plugin-javascript-obfuscator/dist/index.cjs.js
  • vite-plugin-javascript-obfuscator/dist/index.es.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-javascript-obfuscator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vite-plugin-javascript-obfuscator

A Vite Plugin for javascript-obfuscator

Installation

Install the package:

  • npm npm install --save-dev vite-plugin-javascript-obfuscator
  • yarn yarn add --dev vite-plugin-javascript-obfuscator
  • pnpm pnpm i vite-plugin-javascript-obfuscator -D

Usage

Example 1

vite.config.js

import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";

export default defineConfig({
  plugins: [
    obfuscatorPlugin({
      options: {
        // your javascript-obfuscator options
        compact: true,
        controlFlowFlattening: false,
        // ...  [See more options](https://github.com/javascript-obfuscator/javascript-obfuscator)
      },
    }),
  ],
});

Example 2

vite.config.js

import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";

export default defineConfig({
  plugins: [
    obfuscatorPlugin({
      include: ["src/path/to/file.js", "path/anyjs/**/*.js", /foo.js$/],
      exclude: [/node_modules/],
      apply: "build",
      debugger: true,
      options: {
        /** your javascript-obfuscator options */ 
        // compact: true,
        // controlFlowFlattening: false,
        // ...  [See more options](https://github.com/javascript-obfuscator/javascript-obfuscator)
      },
    }),
  ],
});

Params

Name Type Default Description
include `Array String RegExp
exclude `Array String RegExp
options Object javascript-obfuscator default options See more options
apply `'serve' 'build' ((this: void, config: UserConfig, env: ConfigEnv) => boolean)`
debugger Boolean false Used for debugging, Print out the path of matching or excluding files.