JavaScript Obfuscator for your sites hosted on netlify, which provide protection for your source code.
npm install netlify-plugin-js-obfuscatorjavascript-obfuscator package, code obfuscation may impact your website's performance.
netlify.toml file.
toml
[[plugins]]
package = "netlify-plugin-js-obfuscator"
# All inputs are optional, so you can omit this section.
# Defaults are shown below.
# You can also refer to javascript-obfuscator’s documentation: https://github.com/javascript-obfuscator/javascript-obfuscator.
[plugins.inputs]
# Compact code output on one line.
compact = false
# Enables numbers conversion to expressions
numbersToExpressions = true
# Enables additional code obfuscation through simplification.
simplify = true
# Randomly shuffles the stringArray array items
shuffleStringArray = true
# Splits literal strings into chunks with length of splitStringsChunkLength option value
splitStrings = true
`
To complete file-based installation, from your project's base directory, use npm package manager to add the plugin to devDependencies in package.json.
`bash
npm install -D netlify-plugin-js-obfuscator
`
Once installed and configured, the plugin will automatically run on the Netlify CI.
$3
To test this plugin locally, you can use the Netlify CLI:
`bash
Install the Netlify CLI.
npm install netlify-cli -g
In the project working directory, run the build as Netlify would with the build bot.
netlify build
``