Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

javascript-obfuscator plugin for Webpack

License

NotificationsYou must be signed in to change notification settings

javascript-obfuscator/webpack-obfuscator

Repository files navigation

npm version

Installation

This plugin requires Webpack@5. If you depend on Webpack@4, please useversion 2 of the plugin.

Install the plugin with NPM and add it to your devDependencies:

npm install --save-dev javascript-obfuscator webpack-obfuscator

Plugin usage:

varWebpackObfuscator=require('webpack-obfuscator');// ...// webpack plugins arrayplugins:[newWebpackObfuscator({rotateStringArray:true},['excluded_bundle_name.js'])]

Loader usage:

Define a rule in your webpack config and use the obfuscator-loader as the last of your loaders for your modules. You can add theenforce: 'post' flag to ensure the loader will be called after normal loaders:

varWebpackObfuscator=require('webpack-obfuscator');// webpack loader rules arrayrules:[{test:/\.js$/,exclude:[path.resolve(__dirname,'excluded_file_name.js')],enforce:'post',use:{loader:WebpackObfuscator.loader,options:{rotateStringArray:true}}}]

obfuscatorOptions

Type:Object Default:null

Options forjavascript-obfuscator. Should be passed exactly like described on their page.

excludes (plugin only)

Type:Array orString Default:[]

Bundle name is output file name after webpack compilation. With multiple webpack entries you can set bundle name inoutput object with aliases[name] or[id].

Syntax for excludes array is syntax formultimatch package. You can see examples on package page.

Few syntax examples:['excluded_bundle_name.js', '**_bundle_name.js'] or 'excluded_bundle_name.js'

Example:

// webpack.config.js'use strict';const JavaScriptObfuscator = require('webpack-obfuscator');module.exports = {    entry: {        'abc': './test/input/index.js',        'cde': './test/input/index1.js'    },    output: {        path: 'dist',        filename: '[name].js' // output: abc.js, cde.js    },    plugins: [        new JavaScriptObfuscator({            rotateStringArray: true        }, ['abc.js'])    ]};

Can be used to bypass obfuscation of some files.

License

Copyright (C) 2022Timofey Kachalov.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ANDON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


[8]ページ先頭

©2009-2025 Movatter.jp