react-native 中使用redux 优化 Connect 使用装饰器简化代码报错

报错信息

error: bundling failed: Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.

 

解决办法

cnpm install babel-plugin-transform-decorators-legacy  --save-dev
cnpm install  @babel/plugin-proposal-decorators --save-dev


// 修改.babelrc文件 在plugins 中增加下面代码
"plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }]
  ]

 

posted on 2018-11-08 15:40  奋斗中的码农  阅读(449)  评论(0编辑  收藏  举报

导航