Non*_*Non 5 javascript ecmascript-6 reactjs eslint gatsby
我收到了关于此问题的错误报告:https://github.com/gatsbyjs/gatsby/issues/25920 但是盖茨比的人似乎太忙而无法回答,所以也许这里的其他人知道这个问题。
请记住,我StaticQuery
在代码中根本没有使用该组件。
我遇到了完全相同的问题。
在拥有它之前我注意到了其他一些开发人员:https ://github.com/gatsbyjs/gatsby/issues/6350
我看到一些开发人员建议export
从query
变量中删除 ,因此:
const query = graphql`...`
Run Code Online (Sandbox Code Playgroud)
而不是这个:
export const query = graphql`...`
Run Code Online (Sandbox Code Playgroud)
但这不是我的情况。直到几个小时前一切都运转良好。
我的所有页面都有这样的查询:
// this is my component
const CollectionProduct = ({ data }) => {...}
// and outside the component is the query
export const query = graphql`
query($handle: String!) {
shopifyCollection(handle: { eq: $handle }) {
products {
id
title
handle
createdAt
}
}
}
}
`
Run Code Online (Sandbox Code Playgroud)
export
在我正在使用的组件中const query
,我的所有页面都以相同的方式定义,并且之前没有任何问题。我已经升级和降级了 Gatsby 的版本,但还是出现同样的问题。
我的问题是在我.eslintrc.js
向项目添加配置文件后出现的;由于 ESLint,这是我的项目构建在实时站点上失败的选项吗?
在本地它可以工作,我可以构建该项目并在我的设备上看到它localhost
,没有任何问题。但当我看到实时网站时,它会出现Loading(StaticQuery)
白屏。我什至没有StaticQuery
在任何地方使用组件。仅useStaticQuery
在非页面或模板组件上挂钩。
这是我的 ESLint 配置:
// this is my component
const CollectionProduct = ({ data }) => {...}
// and outside the component is the query
export const query = graphql`
query($handle: String!) {
shopifyCollection(handle: { eq: $handle }) {
products {
id
title
handle
createdAt
}
}
}
}
`
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我有一个类似的问题,突然发生。https://github.com/gatsbyjs/gatsby/issues/24890上的有人建议尝试清理您的项目。
对我来说,删除两者node_modules
然后yarn.lock
重新生成它们就成功了!
编辑:这似乎已在 gatsby 2.24.11 中修复
归档时间: |
|
查看次数: |
3154 次 |
最近记录: |