babel-plugin-transform-minify-catch-param
Version:
Babel plugin that minifies catch parameter names to reduce bundle size
47 lines (35 loc) • 827 B
Markdown
# babel-plugin-transform-minify-catch-param
Babel plugin that minifies unused catch clause parameter names in JavaScript/TypeScript to reduce bundle size.
## What does it do?
Removes the parameter in `catch` clauses if it is not used inside the block.
## Example
**Before:**
```js
try {
// ...
} catch (error) {} // error is not used
```
**After:**
```js
try {
// ...
} catch {}
```
## Install
```bash
npm i -D babel-plugin-transform-minify-catch-param
#or
yarn add -D babel-plugin-transform-minify-catch-param
```
## How to configure
Add to your Babel config:
See the official Babel documentation for more details: [https://babeljs.io/docs/en/configuration](https://babeljs.io/docs/en/configuration)
```json
{
"plugins": [
"babel-plugin-transform-minify-catch-param"
]
}
```
## License
[MIT](./LICENSE)