问答详情
源自:-

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 = [];

}

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

提问者:慕粉007羊 2019-05-27 10:06

个回答