4
尝试导入此文件:如何导入.graphql文件用的WebPack
subscription onNewNotification {
notification {
id
content
seen
}
}
运行巴贝尔节点时,编译整个事情我得到这个错误:SyntaxError: .../graphql/NotificationSubscription.graphql: Unexpected token, expected ;
这是怎么我的WebPack装载机看起来像:
module: {
loaders: [
{
test: /\.js?$/,
include: [
path.join(__dirname, 'client'),
path.join(__dirname, 'server/shared'),
],
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react-hmre'],
},
},
{
test: /\.json?$/,
loader: 'json-loader',
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
},
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?mimetype=image/svg+xml' },
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
},
],
},
不知道为什么发生这种情况,我正在关注的阿波罗文档和我没有看到谷歌这事:http://dev.apollodata.com/react/webpack.html
我有同样的问题,你有没有找到解决办法? –
你使用任何babel插件吗? –
我应该使用一个特殊的babel插件吗? – Coyolero