mobx装饰器为什么不成功

来源:3-4 store配置(2)

月牙3383507

2018-09-19

配置mobx装饰器时我已经在.babelrc中配置{
“presets”:[
[“es2015”,{“loose”: true}],
“stage-1”,
“react”
],
“plugins”: [“transform-decorators-legacy”, “react-hot-loader/babel”]
}
为啥我还是报这种错啊:
C:\Users\Administrator\Desktop\react\react-code-teach\client\views\topic-list\index.jsx
16:1 error Parsing error: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead.

14 | @observer
15 |

16 | export default class TopicList extends React.Component {
| ^
17 | constructor() {
18 | super()
19 | this.changName = this.changName.bind(this)

✖ 1 problem (1 error, 0 warnings)

@ ./client/config/router.jsx 11:13-49
@ ./client/views/App.jsx
@ ./client/app.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8889 (webpack)/hot/dev-server.js react-hot-loader/patch ./client/app.js
Child html-webpack-plugin for “index.html”:
2 assets
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./client/template.html 380 bytes {1} [built]
[1] ./node_modules/lodash/lodash.js 527 KiB {1} [built]
[2] (webpack)/buildin/global.js 489 bytes {1} [built]
[3] (webpack)/buildin/module.js 497 bytes {1} [built]
i 「wdm」: Failed to compile.

写回答

1回答

Jokcy

2018-09-19

Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead


错误提示是不要在装饰器和class之间有export关键字

0
0

React全栈+服务器渲染(ssr)打造社区Webapp

【毕设面试】只会写业务代码?out了,带你学会搭建属于自己的工程!

768 学习 · 414 问题

查看课程