错误:
ERROR in ./react/index.js
Module parse failed: Unexpected token (8:12)You may need an appropriate loader to handle this file type.
|
| return(
| <h1>123</h1>
| )
| }
webpack.react.config.js(配置文件)
{
test:
/
\.js
$/,
loader:'
babel-loader',
exclude:/
node_modules/,
include:
path.
resolve(__dirname, '/
react/'),
} ,
报错原因:
在include中写文件名称的时候不用写"/"
正确的:
include:path.resolve(__dirname, 'react'),