webpack配置报错

错误:

ERROR in ./react/index.js

Module parse failed: Unexpected token (8:12)
You may need an appropriate loader to handle this file type.
|
|         return(
|             

123


|         )

|     }

webpack.react.config.js(配置文件)

{
test: / \.js $/,
loader:' babel-loader',
exclude:/ node_modules/,
include: path. resolve(__dirname, '/ react/'),
} ,


报错原因:

在include中写文件名称的时候不用写"/"

正确的:

include:path.resolve(__dirname, 'react'),

你可能感兴趣的:(webpack配置报错)