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

    ]

完成解决!

你可能感兴趣的:(2018-12-24 。redux connect的装饰器问题)