【发布时间】:2016-08-18 19:06:05
【问题描述】:
我已经阅读了许多其他详细描述类似问题的 S/O 帖子,但是我找不到针对我的特定问题的解决方案。
我安装了一个节点模块,但我现在收到此错误消息:
(音节-是我安装的模块)
index.js:641 ./~/syllable/problematic.json
Module parse failed: /Desktop/App/node_modules/syllable/problematic.json Unexpected token (2:11)
You may need an appropriate loader to handle this file type.
这是我的 Webpack 配置
var config = {
entry: './main.js',
output: {
path: './',
filename: 'index.js',
},
devServer: {
inline: true,
port: 3000
},
module: {
loaders: [
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
},
{ //<-- this line is throwing an unexpected token error
test: /\.json$/,
loader: 'json'
}
}
]
}
}
module.exports = config;
注意:我已经安装了 es2015,我尝试重写 webpack.config.js 几次都无济于事。
我做错了什么?
【问题讨论】: