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

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 }]

    ]

完成解决!

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容