@@ -14,7 +14,6 @@ exports.onCreateWebpackConfig = ({ actions, stage }) => {
14
14
if ( stage !== BUILD_HTML_STAGE && stage !== BUILD_CSS_STAGE ) {
15
15
return
16
16
}
17
-
18
17
actions . setWebpackConfig ( {
19
18
plugins : [
20
19
new WebpackAssetsManifest ( {
@@ -30,22 +29,25 @@ exports.onPostBuild = async (
30
29
userPluginOptions
31
30
) => {
32
31
const pluginData = makePluginData ( store , assetsManifest , pathPrefix )
32
+ console . log ( `onPostBuild` , { pluginData, assetsManifest } )
33
33
const pluginOptions = { ...DEFAULT_OPTIONS , ...userPluginOptions }
34
34
35
- const { redirects } = store . getState ( )
35
+ const { redirects, pages } = store . getState ( )
36
36
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` ,
47
44
} )
48
- }
45
+ }
46
+ // return {
47
+ // fromPath: page.matchPath,
48
+ // toPath: page.path,
49
+ // }
50
+ } )
49
51
50
52
await Promise . all ( [
51
53
buildHeadersProgram ( pluginData , pluginOptions , reporter ) ,
@@ -71,9 +73,7 @@ const pluginOptionsSchema = function ({ Joi }) {
71
73
mergeLinkHeaders : Joi . boolean ( ) . description (
72
74
`When set to true, turns off the default gatsby js headers`
73
75
) ,
74
- mergeCachingHeaders : Joi . boolean ( ) . description (
75
- `When set to true, turns off the default caching headers`
76
- ) ,
76
+
77
77
transformHeaders : Joi . function ( )
78
78
. maxArity ( 2 )
79
79
. description (
0 commit comments