Socket
Socket
Sign inDemoInstall

webpack-javascript-obfuscator-plugin

Package Overview
Dependencies
93
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    webpack-javascript-obfuscator-plugin

一个简易的webpack加密javascript的插件


Version published
Weekly downloads
18
increased by50%
Maintainers
1
Install size
28.9 MB
Created
Weekly downloads
 

Readme

Source

webpack-javascript-obfuscator-plugin

本插件依赖javascript-obfuscator对前端代码进行AST混淆加密

Install

With npm:

npm i webpack-javascript-obfuscator-plugin --save-dev

Or yarn:

yarn add webpack-javascript-obfuscator-plugin --dev

Usage

首先引入

// 引入
const WebpackJavascriptObfuscatorPlugin = require("webpack-javascript-obfuscator-plugin");

在webpack的插件选项中

//在webpack的plugins中实例化此插件
plugins: [ new WebpackJavascriptObfuscatorPlugin(options) ]
//如果你只想在打包时进行加密
plugins: process.env.NODE_ENV == "production" ? [ new WebpackJavascriptObfuscatorPlugin(options) ] : []

Options(不添加默认中度混淆,最佳性能)

默认:

{
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 0.75,
    deadCodeInjection: true,
    deadCodeInjectionThreshold: 0.4,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: true,
    identifierNamesGenerator: "hexadecimal",
    log: false,
    numbersToExpressions: true,
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: false,
    shuffleStringArray: true,
    simplify: true,
    splitStrings: true,
    splitStringsChunkLength: 10,
    stringArray: true,
    stringArrayEncoding: ["base64"],
    stringArrayIndexShift: true,
    stringArrayWrappersCount: 2,
    stringArrayWrappersChainedCalls: true,
    stringArrayWrappersParametersMaxCount: 4,
    stringArrayWrappersType: "function",
    stringArrayThreshold: 0.75,
    transformObjectKeys: true,
    unicodeEscapeSequence: false
}

添加或修改配置项请移步JavaScript Obfuscator Options

Keywords

FAQs

Last updated on 04 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc