- Notifications
You must be signed in to change notification settings - Fork88
javascript-obfuscator plugin for Webpack
License
javascript-obfuscator/webpack-obfuscator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
varWebpackObfuscator=require('webpack-obfuscator');// ...// webpack plugins arrayplugins:[newWebpackObfuscator({rotateStringArray:true},['excluded_bundle_name.js'])]
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}}}]
Type:Object
Default:null
Options forjavascript-obfuscator. Should be passed exactly like described on their page.
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.
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.
About
javascript-obfuscator plugin for Webpack
Resources
License
Uh oh!
There was an error while loading.Please reload this page.