Socket
Socket
Sign inDemoInstall

rollup-plugin-obfuscator

Package Overview
Dependencies
90
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rollup-plugin-obfuscator

The most powerful rollup plugin for javascript-obfuscator


Version published
Maintainers
1
Created

Readme

Source

rollup-plugin-obfuscator

npm

The most powerful rollup plugin for javascript-obfuscator.

yarn add --dev rollup-plugin-obfuscator javascript-obfuscator

or

npm install --save-dev rollup-plugin-obfuscator javascript-obfuscator

Why?

There is already a plugin for this, but it's outdated and not powerful enough for me.

With this plugin you install javascript-obfuscator separately from the plugin (as seen in the installation instructions above). This plugin is designed so javascript-obfuscator will always be updatable, independently from rollup-plugin-obfuscator.

Additionally, it's much more powerful because you can apply obfuscation settings:

  • per file
  • to the whole bundle

The point is that you can avoid obfuscating your open-source dependencies, which results in a huge performance boost.

Usage

import obfuscator from 'rollup-plugin-obfuscator';

export default {
	input: 'src/main.js',
	plugins: [
		obfuscator({
			fileOptions: {
				// Your javascript-obfuscator options here
				// Will be applied on each file separately. Set to `false` to disable
				// See what's allowed: https://github.com/javascript-obfuscator/javascript-obfuscator
			},
			globalOptions: {
				// Your javascript-obfuscator options here
				// Will be applied on the whole bundle. Set to `false` to disable
				// See what's allowed: https://github.com/javascript-obfuscator/javascript-obfuscator
			},
		}),
	]
}

Options

globalOptions

Type: Object | false
Default: {}

Options that will be passed to javascript-obfuscator when it processes each file. If you don't want each of your file to be processed individually, you can set this to false. See allowed options here.

fileOptions

Type: Object | false
Default: {}

Options that will be passed to javascript-obfuscator when it processes the whole bundle. If you don't want to apply the obfuscation to the whole bundle, you can set this to false. See allowed options here.

include

Type: String | Array[...String]
Default: ['**/*.js', '**/*.ts']

Which files to obfuscate with fileOptions.

exclude

Type: String | Array[...String]
Default: ['node_modules/**']

Which files to skip applying fileOptions on.

obfuscator

Type: JavascriptObfuscator
Default: require('javascript-obfuscator')

This plugin uses the version of javascript-obfuscator you installed alongside with it, but you are free to override it (for example, if you want to use a fork).

FAQs

Last updated on 10 May 2022

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