我想要一条路线: /blog/:blogId/:slug
我在我的gatsby-node.js
-
exports.onCreatePage = async ({ page, actions }) => {
const { createPage } = actions
createPage({
path: "/blog/",
matchPath: "/blog/:blogId/:slug",
component: path.resolve("src/components/layouts/SingleBlogPageLayout.jsx"),
})
}
它可以完美地工作,gatsby develop
但在gatsby build
错误是:
failed Building static HTML for pages - 6.584s
ERROR #95313
Building static HTML failed for path "/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
247 |
248 |
> 249 | var store = didStoreComeFromProps ? props.store : contextValue.store;
| ^
250 | var childPropsSelector = useMemo(function () {
251 | // The child props selector needs the store reference as an input.
252 | // Re-create this selector whenever the store changes.
WebpackError: TypeError: Cannot read property 'store' of null
- connectAdvanced.js:249 ConnectFunction
node_modules/react-redux/es/components/connectAdvanced.js:249:1
在gatsby-browser.js
&gatsby-ssr.js
文件中添加redux包装器
Import wrapWithProvider from "./wrap-with-provider"
export const wrapRootElement = wrapWithProvider
希望这行得通
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句