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吗? #4

Open
ZhyCong opened this issue Mar 29, 2018 · 2 comments
Open

请问支持mobx吗? #4

ZhyCong opened this issue Mar 29, 2018 · 2 comments

Comments

@ZhyCong
Copy link

ZhyCong commented Mar 29, 2018

我试了引入mobx, 报错了, 查了一下, 好像是不支持decorators (@)

参考: https://stackoverflow.com/questions/41138534/mobx-react-unexpected-token

@qiqiboy

@qiqiboy
Copy link
Owner

qiqiboy commented Mar 29, 2018

decorators 是一个不稳定的特性,所以没有默认支持。参考:https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#can-i-use-decorators

如果要自己项目支持的话,需要自行安装:
第一步:npm install --save-dev babel-plugin-transform-decorators-legacy
第二步:修改 package.json,在babel字段下,添加 "plugins": [ "transform-decorators-legacy" ] 即可。

316548086_929681965

@ZhyCong
Copy link
Author

ZhyCong commented Mar 29, 2018

好的, 搞定了, 多谢

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

2 participants