Mobx中裝飾器語法的環境配置
阿新 • • 發佈:2018-12-05
1.快速新建一個專案
npx create-react-app mobx-react
cd mobx-react
yarn eject
報錯的話執行以下操作
git add .
git commit -m
"aa"
2.安裝依賴包
yarn add
babel-plugin-transform-decorators-legacy @babel/plugin-proposal-decorators mobx mobx-react --save-dev
3.配置package.json
"babel": { "plugins":[ [ "@babel/plugin-proposal-decorators", { "legacy":true } ], [ "@babel/plugin-proposal-class-properties", { "loose":true } ] ], "presets":[ "react-app" ] }
The End