rollup-plugin-obfuscator
The most powerful rollup plugin for javascript-obfuscator.
$ yarn add rollup-plugin-obfuscator javascript-obfuscator
You also need to install javascript-obfuscator
alongside or this plugin won't work.
Why?
There is already a plugin for this, but it's outdated and not powerful enough for me.
I'm not saying I'll be any better at maintaining this plugin, but the advantage of it is that you manage your version of javascript-obfuscator
yourself.
Additionally, the other niceties are that 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: {
},
globalOptions: {
},
include: ['**/*.js', '**/*.ts'],
exclude: ['node_modules/**'],
obfuscator: require('javascript-obfuscator'),
}),
]
}
Note that a couple javascript-obfuscator options are forced. This is necessary for this plugin to work. Check out which ones you can't use here.