React-MobX Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean

前端 未结 5 763
無奈伤痛
無奈伤痛 2021-02-12 11:52

I get the following error: 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 \'dec

5条回答
  •  梦如初夏
    2021-02-12 12:51

    React native 0.59

    babel.config.js:

    { 
      "presets": ["module:metro-react-native-babel-preset"],
      "plugins": [
            ["@babel/plugin-transform-flow-strip-types"],
            ["@babel/plugin-proposal-decorators", { "legacy": true}],
            ["@babel/plugin-proposal-class-properties", { "loose": true}]
        ]
    }
    

    npm install @babel/plugin-transform-flow-strip-types @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties --save
    

    Source: https://github.com/facebook/react-native/issues/20588#issuecomment-448218111

提交回复
热议问题