Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mobx and create-react-app #521

Closed
RainerAtSpirit opened this issue Aug 29, 2016 · 8 comments
Closed

mobx and create-react-app #521

RainerAtSpirit opened this issue Aug 29, 2016 · 8 comments

Comments

@RainerAtSpirit
Copy link

It would be great to see an example that works with create-react-app without having the need to eject immediately in order to support the babel transform-decorators-legacy.
Looks like create-react-app won't support legacy plugins (facebook/create-react-app#214) so it might be worth demonstrating using mobx with the OOTB create-reach-app configuration instead.

@mweststrate
Copy link
Member

Tada: https://github.com/mobxjs/create-react-app-mobx/

@EQuimper
Copy link

EQuimper commented Aug 31, 2016

You can add the transform-decorators-legacy yourself in node_modules/react-scripts/config/babel.dev.js

image

@RainerAtSpirit
Copy link
Author

Excellent, that will do the job!

@mweststrate
Copy link
Member

@EQuimper would you mind adding that to the README of create-react-app-mobx as alternative?

@EQuimper
Copy link

EQuimper commented Sep 1, 2016

@mweststrate Yes should be a good idea

@RainerAtSpirit
Copy link
Author

@EQuimper Good workaround, but I'd rather have more examples that demonstrate using mobx with standard syntax. Projects like e.g Aurelia have been suffered in the past by using experimental feature of jspm and babel, which later changed or where withdrawn. I'd rather have an option to not go down the same route.

@maczyt
Copy link

maczyt commented Jul 3, 2017

Now, you can push require.resolve('babel-plugin-transform-decorators-legacy') in node_modules/babel-preset-react-app/index.js plugins array

@pvgdevelop
Copy link

This article clearly explains how to solve this issue.

Basically it all boils down to two simple steps:

1.npm install --save-dev babel-plugin-transform-decorators-legacy
2. Add babel configuration to your package.json.

    "plugins": [
      "transform-decorators-legacy"
    ],

screen shot 2018-06-19 at 8 31 05 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants