【发布时间】:2018-07-30 03:32:33
【问题描述】:
我对 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]
非常感谢!!
【问题讨论】:
-
如果可能,请分享您的 webpack 配置、package.json 和 .babelrc
-
我已经在评论中分享了它,因为我不能把它放在原来的问题中
-
抱歉错过了,请在下方查看我的答案
标签: reactjs webpack babeljs jsx