Plugin for Rollup to obfuscate JS code
npm install rollup-plugin-code-obfuscator``sh`
pnpm add --save-dev rollup-plugin-code-obfuscator javascript-obfuscator
1. javascript-obfuscator is installed separately from the rollup plugin, so it will always be updatable (unlike the official rollup plugin which has been outdated for years!)
2. You can decide if you prefer to apply obfuscation:
- the traditional way, to the whole bundle
- to each file separately, avoiding obfuscating your open-source dependencies, which results in a huge performance boost
`js
import obfuscator from 'rollup-plugin-code-obfuscator';
export default {
input: 'src/main.js',
plugins: [
obfuscator({
options: {
// Your javascript-obfuscator options here
// See what's allowed: https://github.com/javascript-obfuscator/javascript-obfuscator
},
}),
]
}
`
Type: Object{}
Default:
Options that will be passed to javascript-obfuscator.
See allowed options here.
Type: String | RegExp | Array[...String|RegExp][/\.vue$/, /\.[jt]sx$/,/\.[jt]s$/]
Default:
Type: String | RegExp | Array[...String|RegExp]['node_modules/**']
Default:
Type: JavascriptObfuscatorrequire('javascript-obfuscator')
Default:
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).