George Bleasdale
George Bleasdale

Reputation: 351

Issues when setting up Mobx with create-react-app

I'm getting an error when setting up Mobx with react, can anyone give me a simple step by step? I'm fairly new to React and I'm still getting my head around the files that come with it.

Here's what I did:

Here's the problem I'm getting: enter image description here

What I tried:

The error seems to suggest that I need to set legacy to true in node_modules\@babel\plugin-proposal-decorators\lib\index.js. I tried that and it didn't work. I searched for the problem on google and it seems like it could be an issue with Babel 7?

Upvotes: 0

Views: 419

Answers (1)

Hespen
Hespen

Reputation: 1452

You need to pass the option with the config you setup in your package.json

{
 "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }]
  ]
}

You can check the docs here: https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html

Upvotes: 1

Related Questions