【发布时间】:2018-10-31 21:27:15
【问题描述】:
当我安装 Mobx 和 Mobx 反应时,我收到以下错误。
./src/index.js
Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option,
whose value must be a boolean. If you are migrating from Babylon/Babel 6 or
want to use the old decorators proposal, you should use the 'decorators-legacy'
plugin instead of 'decorators'.
现在我已经弹出了依赖项并将 decorators-legacy 作为插件安装。这就是我的 package.json 文件中的内容
"babel": {
"plugins": [
"transform-decorators-legacy"
],
"presets": [
"react-app"
]
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.1.2",
"babel-plugin-transform-decorators-legacy": "^1.3.5"
}
任何帮助都将不胜感激,因为过去几天这一直让我发疯。
【问题讨论】:
-
你试过让你的配置看起来像the config in this issue吗?
-
babelrc 文件在哪里?
-
在问题的最顶端。
-
现在我收到以下错误
./src/index.js SyntaxError: /Users/briankaty1/Desktop/mobx/mobx2/bird-cage/src/index.js: Unexpected token (7:16) 5 | import * as serviceWorker from './serviceWorker'; 6 | > 7 | ReactDOM.render(<App />, document.getElementById('root'));
标签: reactjs mobx mobx-react