use create-react-app for build mobx project.
- add mobx in project.
- let vscode edit mobx code no waring.
- add antd, async/await, scss loader, and my environment.
- import outside /src files.
If you are interested in this project, you can give me feedback in the issue.
如果你有任何疑问,请在 issue 提交给我,我会尽心帮你解答。
Ok, so here’s what you do when setting up a new React app:
-
Run create-react-app. This creates a new app with the official configuration.
-
Run npm run eject. This moves files around and makes your app’s configuration accessible.
-
Run npm install --saveDev babel-plugin-transform-decorators-legacy. This installs the Babel plugin for decorators. It’s called legacy even though it’s a feature from the far future.
-
Open package.json, find the "babel" section (line 78 for me), and add 4 lines so it looks like this:
//package.json
"babel": {
"plugins": [
"transform-decorators-legacy"
],
"presets": [
"react-app"
]
}
- Run npm install --save mobx mobx-react. This installs MobX.
You’re ready to go. Happy hacking! ?
Steps to Reproduce:
-
Create Typescript file with decorators (like mobx).
-
Enable experimentalDecorators in tsconfig.json.
{
"compilerOptions": {
"experimentalDecorators": true
}
}