Mobx: Support for the experimental syntax 'decorators-legacy' isn't currently enabled

Created on 21 Jul 2019  ·  2Comments  ·  Source: mobxjs/mobx

My project built the application based on react-app-rewired, then installed mobx again, mobx-react dependency package import, error reporting:Support for the experimental syntax 'decorators-legacy' isn't currently enabled,When you see an error, install again @Babel/plugin-proposal-decorators, @Babel/plugin-proposal-class-properties, @Babel/preset-env, Babel-plugin-transform-decorators-legacy still exists an error after import

import CounterView from './CounterView';
  5 |
> 6 | @observer // this decorator is must
    | ^
  7 | class MobxCounter extends React.Component {
  8 |   // 观察者
  9 |   @observable count = 0;

.babelrc file:

 "presets": [
    "@babel/preset-react",
    "@babel/preset-env",
    ["react-app", {
      "absoluteRuntime": false
    }]
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", {
      "legacy": true
    }],
    ["@babel/plugin-proposal-class-properties", {
      "loose": true
    }],
    "transform-decorators-legacy"
  ]

How to solve this problem, please help me, ok?

❌ invalid

All 2 comments

Sorry, but this isn't MobX related question, more likely ask in react-app-rewired repo.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

Was this page helpful?
0 / 5 - 0 ratings