错误:locals [0]似乎不是启用了热模块替换API的`module`对象

时间:2018-03-02 18:09:01

标签: node.js reactjs

我试图在节点服务器上启动我的应用程序并收到错误:

未捕获错误:locals [0]似乎不是启用了热模块替换API的module对象。您应该在Babel配置中使用env部分禁用生产中的react-transform-hmr。我已经关注了这个链接:

{
"presets": ["es2015", "stage-0"],
"env": {
// only enable it when process.env.NODE_ENV is 'development' or undefined
"development": {
  "plugins": [["react-transform", {
    "transforms": [{
      "transform": "react-transform-hmr",
      // if you use React Native, pass "react-native" instead:
      "imports": ["react"],
      // this is important for Webpack HMR:
      "locals": ["module"]
    }]
    // note: you can put more transforms into array
    // this is just one of them!
  }]]
 }
}
}

现在,我该怎么办?通过评论或更改某些行?

0 个答案:

没有答案