-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(gatsby): decouple html activities #28648
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,16 +113,15 @@ module.exports = { | |
|
||
// Remove the following when merging GATSBY_EXPERIMENTAL_DEV_SSR | ||
const directoryPath = withBasePath(directory) | ||
const { buildHTML } = require(`../commands/build-html`) | ||
const { buildRenderer, doBuildPages } = require(`../commands/build-html`) | ||
const createIndexHtml = async (activity: ActivityTracker): Promise<void> => { | ||
try { | ||
await buildHTML({ | ||
const rendererPath = await buildRenderer( | ||
program, | ||
stage: Stage.DevelopHTML, | ||
pagePaths: [`/`], | ||
workerPool, | ||
activity, | ||
}) | ||
Stage.DevelopHTML, | ||
activity.span | ||
) | ||
await doBuildPages(rendererPath, [`/`], activity, workerPool) | ||
} catch (err) { | ||
if (err.name !== `WebpackError`) { | ||
report.panic(err) | ||
|
@@ -139,9 +138,10 @@ module.exports = { | |
} | ||
const indexHTMLActivity = report.phantomActivity(`building index.html`, {}) | ||
|
||
let pageRenderer: string | ||
if (process.env.GATSBY_EXPERIMENTAL_DEV_SSR) { | ||
const { buildRenderer } = require(`../commands/build-html`) | ||
await buildRenderer(program, Stage.DevelopHTML) | ||
pageRenderer = await buildRenderer(program, Stage.DevelopHTML) | ||
const { initDevWorkerPool } = require(`./dev-ssr/render-dev-html`) | ||
initDevWorkerPool() | ||
} else { | ||
|
@@ -495,7 +495,7 @@ module.exports = { | |
// Let renderDevHTML figure it out. | ||
page: undefined, | ||
store, | ||
htmlComponentRendererPath: `${program.directory}/public/render-page.js`, | ||
htmlComponentRendererPath: pageRenderer, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think let pageRenderer: string
if (process.env.GATSBY_EXPERIMENTAL_DEV_SSR) {
// ...
pageRenderer = await buildRenderer(program, Stage.DevelopHTML)
// ...
} else {
// we don't set `pageRenderer` value in this codepath There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be in the same process.env.GATSBY_EXPERIMENTAL_DEV_SSR, right? I've tested it and didn't have an issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, true. Didn't see the this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point 😂 |
||
directory: program.directory, | ||
}) | ||
const status = process.env.GATSBY_EXPERIMENTAL_DEV_SSR ? 404 : 200 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now done inside start-server