Wepack编译失败与reactjs项目

时间:2020-03-04 06:50:49

标签: reactjs webpack

在运行如下所示的react项目时,我遇到了webpack编译错误:

    ERROR in ./src/dispatcher-dev/App.js 17:20
    Module parse failed: Unexpected token (17:20)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    | class App extends Component {
    >   componentDidMount = () => {
    |     // Check the type of browser and add a class accordingly to the body
    |     let browser = (function(){
     @ ./src/dispatcher-dev/index.js 7:0-24 10:36-39
     @ multi ./src/dispatcher-dev/index.js

我已经将babel-loader包括在我的Webpack中,还包括了react-domprop-types

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

不可能在js类中添加静态属性。

要使用该功能,您应该将this插件添加到babel

相关问题