Webpack的反应配置问题

时间:2018-02-19 20:48:53

标签: reactjs webpack babeljs jsx

我对webpack的配置有疑问。当我安装了依赖项" react react-dom"

时发生了错误

根据我的搜索,一切都很好,但肯定不是。

错误如下:

Hash: f2d1526b060b4c79da6f
Version: webpack 3.11.0
Time: 342ms
     Asset       Size  Chunks             Chunk Names
    app.js     2.8 kB       0  [emitted]  main
index.html  353 bytes          [emitted]
   [0] multi ./src/index.jsx 28 bytes {0} [built]
   [1] ./src/index.jsx 206 bytes {0} [built] [failed] [1 error]

ERROR in ./src/index.jsx
Module parse failed: Unexpected token (7:6)
You may need an appropriate loader to handle this file type.
|   render(){
|     return(
|       <h1>Ar</h1>
|     )
|   }
 @ multi ./src/index.jsx
Child html-webpack-plugin for "index.html":
     1 asset
       [0] ./node_modules/html-webpack-                
plugin/lib/loader.js!./src/assets/index.html 690 bytes {0} [built]
       [2] (webpack)/buildin/global.js 509 bytes {0} [built]
       [3] (webpack)/buildin/module.js 517 bytes {0} [built]

非常感谢!!

1 个答案:

答案 0 :(得分:0)

安装rs.add({host: "mongo_gc_1:27017" }) rs.add({host: "mongo_gc_2:27017" }) rs.add({host: "mongo_gc_3:27017" }) conf = rs.conf() conf.members[4].priority = 0 conf.members[5].priority = 0 conf.members[6].priority = 0 conf.members[4].hidden = true conf.members[5].hidden = true conf.members[6].hidden = true rs.reconfig(conf) ;

尝试:

npm i -D babel-core