@@ -40,20 +40,11 @@ type MakeHandlerParams = {
40
40
NextServer : NextServerType
41
41
staticManifest : Array < [ string , string ] >
42
42
mode : 'ssr' | 'odb'
43
- useHooks : boolean
44
43
}
45
44
46
45
// We return a function and then call `toString()` on it to serialise it as the launcher function
47
46
// eslint-disable-next-line max-lines-per-function
48
- const makeHandler = ( {
49
- conf,
50
- app,
51
- pageRoot,
52
- NextServer,
53
- staticManifest = [ ] ,
54
- mode = 'ssr' ,
55
- useHooks,
56
- } : MakeHandlerParams ) => {
47
+ const makeHandler = ( { conf, app, pageRoot, NextServer, staticManifest = [ ] , mode = 'ssr' } : MakeHandlerParams ) => {
57
48
// Change working directory into the site root, unless using Nx, which moves the
58
49
// dist directory and handles this itself
59
50
const dir = path . resolve ( __dirname , app )
@@ -70,10 +61,15 @@ const makeHandler = ({
70
61
const { appDir } : ExperimentalConfigWithLegacy = conf . experimental
71
62
// Next 13.4 conditionally uses different React versions and we need to make sure we use the same one
72
63
// With the release of 13.5 experimental.appDir is no longer used.
73
- // we will need to check if appDir is set and Next version before running requireHook
74
- if ( appDir && useHooks ) return overrideRequireHooks ( conf . experimental )
64
+ // we will need to check if appDir is set and Next version before running requireHooks
65
+ // const runRequireHooks = async (hook) =>
66
+ // await nextVersionNum()
67
+ // .then((version) => (appDir && version ? hook : null))
68
+ // .catch(() => ({}))
69
+
70
+ if ( appDir ) overrideRequireHooks ( conf . experimental )
75
71
const NetlifyNextServer : NetlifyNextServerType = getNetlifyNextServer ( NextServer )
76
- if ( appDir && useHooks ) return applyRequireHooks ( )
72
+ if ( appDir ) applyRequireHooks ( )
77
73
78
74
const ONE_YEAR_IN_SECONDS = 31536000
79
75
@@ -218,7 +214,6 @@ export const getHandler = ({
218
214
publishDir = '../../../.next' ,
219
215
appDir = '../../..' ,
220
216
nextServerModuleRelativeLocation,
221
- useHooks,
222
217
} ) : string =>
223
218
// This is a string, but if you have the right editor plugin it should format as js (e.g. bierner.comment-tagged-templates in VS Code)
224
219
javascript /* javascript */ `
@@ -246,7 +241,7 @@ export const getHandler = ({
246
241
const pageRoot = path . resolve ( path . join ( __dirname , "${ publishDir } " , "server" ) ) ;
247
242
exports . handler = ${
248
243
isODB
249
- ? `builder((${ makeHandler . toString ( ) } )({ conf: config, app: "${ appDir } ", pageRoot, NextServer, staticManifest, mode: 'odb', useHooks: ${ useHooks } }));`
250
- : `(${ makeHandler . toString ( ) } )({ conf: config, app: "${ appDir } ", pageRoot, NextServer, staticManifest, mode: 'ssr', useHooks: ${ useHooks } });`
244
+ ? `builder((${ makeHandler . toString ( ) } )({ conf: config, app: "${ appDir } ", pageRoot, NextServer, staticManifest, mode: 'odb'}));`
245
+ : `(${ makeHandler . toString ( ) } )({ conf: config, app: "${ appDir } ", pageRoot, NextServer, staticManifest, mode: 'ssr'});`
251
246
}
252
247
`
0 commit comments