【发布时间】:2018-11-17 03:48:47
【问题描述】:
尝试在 gatsBy Graphql 中动态传递变量时出现以下错误。
错误
Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
Error: BabelPluginRemoveGraphQL: String interpolations are not allowed in graphql fragments. Included fragments should be referenced as `...MyModule_foo`.
查询
let mytext = 'welcome'
let myQuery = graphql`query($text: String = "${mytext}") {
allGhostPost : allGhostPost(filter:{title:{eq: $text}}) {
edges {
node {
id
slug
}
}
}
}`
请帮忙!!!
【问题讨论】: