babel-plugin-function-try-catch
Babel plugin that can add
try/catch
to function automatically.(一个能为函数自动添加try/catch
的 babel 插件)
Usage
Install:
yarn add babel-plugin-function-try-catch
or
npm install babel-plugin-function-try-catch
Example
before:
var { console;}
after:
var { try console; catch error console; };
How to config
webpack:
rules: [{ test: /\.js$/, exclude: /node_modules/, use: [+ "babel-plugin-function-try-catch", "babel-loader", ]}]