什么情况下onRenderBody不是运行?
In what circumstances is onRenderBody not run?
我有一个 gatsby-ssr.js
和 onRenderBody
在 gatsby develop
或 gatsby build
期间没有得到 运行。
重现:https://github.com/GraphQLGuide/book/tree/repro-no-ssr
ON FILE LOAD
在 gatsby build
期间打印,但 ON RENDER BODY
不是:gatsby-ssr.js
你试过 ES6 表示法吗?
而不是:
exports.onRenderBody = (
{ setHeadComponents, pathname = `/` },
{ crossOrigin = `anonymous` } = {}
) => {
做:
import React from "react"
export const onRenderBody = (
{ setHeadComponents, pathname = `/` },
{ crossOrigin = `anonymous` } = {}
) => {
好像有些webpack版本阻止了部分SSR功能的触发
Interesting/related 线程:
我有一个 gatsby-ssr.js
和 onRenderBody
在 gatsby develop
或 gatsby build
期间没有得到 运行。
重现:https://github.com/GraphQLGuide/book/tree/repro-no-ssr
ON FILE LOAD
在 gatsby build
期间打印,但 ON RENDER BODY
不是:gatsby-ssr.js
你试过 ES6 表示法吗?
而不是:
exports.onRenderBody = (
{ setHeadComponents, pathname = `/` },
{ crossOrigin = `anonymous` } = {}
) => {
做:
import React from "react"
export const onRenderBody = (
{ setHeadComponents, pathname = `/` },
{ crossOrigin = `anonymous` } = {}
) => {
好像有些webpack版本阻止了部分SSR功能的触发
Interesting/related 线程: