connect装饰器报错

来源:4-7 Redux状态管理7-使用 React-redux(Connect 可以用装饰器的方法来书写)

慕婉清1358467

2018-10-05

./src/index.js
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’.

写回答

3回答

慕移动0484045

2018-10-23

这是babel版本的问题好像, 你可以换成npm install --save-dev @babel/plugin-proposal-decorators,然后添加["@babel/plugin-proposal-decorators", { "legacy": true }] 在plugins里。我也遇到这个问题,换了这个就好了

1
1
慕婉清1358467
非常感谢!
2019-01-07
共1条回复

慕瓜8449030

2018-10-08

或者锁死babel的版本 用老版本的

1
0

慕瓜8449030

2018-10-08

这个是babel更新的报错,你更新一下babel版本试试

0
0

Redux+React Router+Node.js全栈开发

全网唯一的React 16+Redux+React Router4实战课程,学到手是你的真本领!

1822 学习 · 750 问题

查看课程