@lagunovsky/babel-plugin-minify-redux-constants
v1.1.0
Published
Can be used to minify and obfuscate code. Works only with string variable declarations
Downloads
1
Readme
Can be used to minify and obfuscate code. Works only with string variable declarations
Example
In
const AUTH_CHECK_REQUEST = '@auth/CHECK_REQUEST';
const AUTH_CHECK_FAILURE = '@auth/CHECK_FAILURE';
const AUTH_CHECK_SUCCESS = '@auth/CHECK_SUCCESS';
Out
const AUTH_CHECK_REQUEST = '0';
const AUTH_CHECK_FAILURE = '1';
const AUTH_CHECK_SUCCESS = '2';
// Dictionary (optional)
{
"0": "@auth/CHECK_REQUEST",
"1": "@auth/CHECK_FAILURE",
"2": "@auth/CHECK_SUCCESS"
}
Installation
$ npm install @lagunovsky/babel-plugin-minify-redux-constants
$ yarn add @lagunovsky/babel-plugin-minify-redux-constants
Usage
Via .babelrc
.babelrc
{
"plugins": [
"minify-redux-constants"
]
}
Options
filter
(data: { filename?: string, name: string, value: string }) => boolean
defaults to ({ filename }) => filename.indexOf('constants') !== -1
filename
- full file pathname
- variable namevalue
- variable value
saveDictionary
(data: {[key: string]: string}) => void
Gets a dictionary of all replacements