Skip to content

Commit a3991ae

Browse files
committed
wip
1 parent 0167e60 commit a3991ae

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/gatsby-node.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ exports.onCreateWebpackConfig = ({ actions, stage }) => {
1414
if (stage !== BUILD_HTML_STAGE && stage !== BUILD_CSS_STAGE) {
1515
return
1616
}
17-
1817
actions.setWebpackConfig({
1918
plugins: [
2019
new WebpackAssetsManifest({
@@ -30,22 +29,25 @@ exports.onPostBuild = async (
3029
userPluginOptions
3130
) => {
3231
const pluginData = makePluginData(store, assetsManifest, pathPrefix)
32+
console.log(`onPostBuild`, { pluginData, assetsManifest })
3333
const pluginOptions = { ...DEFAULT_OPTIONS, ...userPluginOptions }
3434

35-
const { redirects } = store.getState()
35+
const { redirects, pages } = store.getState()
3636

37-
let rewrites = []
38-
if (pluginOptions.generateMatchPathRewrites) {
39-
const { pages } = store.getState()
40-
rewrites = Array.from(pages.values())
41-
.filter(page => page.matchPath && page.matchPath !== page.path)
42-
.map(page => {
43-
return {
44-
fromPath: page.matchPath,
45-
toPath: page.path,
46-
}
37+
const rewrites = []
38+
Array.from(pages.values()).forEach(page => {
39+
const { mode, matchPath, path } = page
40+
if (mode === `SSR`) {
41+
rewrites.push({
42+
fromPath: matchPath ?? path,
43+
toPath: `/.netlify/functions/__ssr`,
4744
})
48-
}
45+
}
46+
// return {
47+
// fromPath: page.matchPath,
48+
// toPath: page.path,
49+
// }
50+
})
4951

5052
await Promise.all([
5153
buildHeadersProgram(pluginData, pluginOptions, reporter),
@@ -71,9 +73,7 @@ const pluginOptionsSchema = function ({ Joi }) {
7173
mergeLinkHeaders: Joi.boolean().description(
7274
`When set to true, turns off the default gatsby js headers`
7375
),
74-
mergeCachingHeaders: Joi.boolean().description(
75-
`When set to true, turns off the default caching headers`
76-
),
76+
7777
transformHeaders: Joi.function()
7878
.maxArity(2)
7979
.description(

0 commit comments

Comments
 (0)