美文网首页
2018-12-24 。redux connect的装饰器问题

2018-12-24 。redux connect的装饰器问题

作者: 无尽甜蜜里悠悠记忆 | 来源:发表于2018-12-25 16:55 被阅读0次

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

然后npm run eject  弹出个性化配置

执行npm run eject 出现问题请执行一下步骤:(mac)

1.git add .

2.git commit -am "Save before ejecting"

修改babel部分,添加代码

"plugins": [

      ["@babel/plugin-proposal-decorators", { "legacy": true }],

      ["@babel/plugin-proposal-class-properties", { "loose" : true }]

    ]

完成解决!

相关文章

网友评论

      本文标题:2018-12-24 。redux connect的装饰器问题

      本文链接:https://www.haomeiwen.com/subject/bhbakqtx.html