为了账号安全,请及时绑定邮箱和手机立即绑定

Unexpected character '@'

修饰器报错

Module parse failed: Unexpected character '@' (50:4)

You may need an appropriate loader to handle this file type.

webpack.config.js文件也配置了

rules: [{
    test: /\.(js|jsx)$/,
    exclude: /node_modules/,
    use: {
        loader: 'babel-loader',
        options: {
            presets: ['env','react'],
            plugins: ['transform-decorators-legacy','transform-class-properties']
        }
    }
}]

index.js

class Store{
    @observable array = [];

}

请问还会报错的原因是什么

正在回答

2 回答

npm install babel-loader@7 -D

babel-loader的版本问题吧

https://github.com/beat-the-buzzer/mobx-todolist

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
mobx入门基础教程
  • 参与学习       18816    人
  • 解答问题       54    个

mobx框架基础入门,使用mobx做状态管理

进入课程

Unexpected character '@'

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信