babel4catch

1.0.11 • Public • Published

babel4catch

一个自动给 function 函数加入 try/catchbabel plugin

Install

yarn add babel4catch

Example

before:

var fn = function(){
  console.log('hello world');
}

after:

var fn = function () {
  try {
    console.log(2);
  } catch (error) {
    console.log(error);
  }
};

How to config

webpack

rules: [{
  test: /\.js$/,
  exclude: /node_modules/,
  use: [
+    "babel4catch",
    "babel-loader",
  ]
}]

Readme

Keywords

Package Sidebar

Install

npm i babel4catch

Weekly Downloads

15

Version

1.0.11

License

ISC

Unpacked Size

5.45 kB

Total Files

3

Last publish

Collaborators

  • allan2coder