我把问题归结为最低限度的测试。我有一个
App.js
包含一位jsx的文件,该文件将编译为
./bundle.js
:
// App.js
module.exports = () => <div/>
我的网页配置似乎很标准
module.exports = {
entry: './App.js',
output: {
filename: './bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
//include: ['./includes'], // <- Problem line
query: {
plugins: [
['transform-react-jsx']
]
}
}
]
}
}
只有在具有
include
已删除。如果我启用该行,则会得到错误
Module parse failed: ./App.js Unexpected token (1:23)
You may need an appropriate loader to handle this file type.
| module.exports = () => <div/>
我不知道为什么在为加载程序指定include时会失败,甚至
include: []
失败并出现相同错误。
有人有主意吗?