Skip to content

Commit a2f71c5

Browse files
committed
chore: add handler space and comments
1 parent efcbf69 commit a2f71c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/templates/server-handler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@ import type { NextConfigComplete } from 'next/dist/server/config-shared.js'
88

99
import { handleCacheControl, handleVary } from '../helpers/headers.js'
1010

11+
// use require to stop NFT from trying to trace these dependencies
1112
const require = createRequire(import.meta.url)
1213

1314
/* these dependencies are generated during the build */
1415
// eslint-disable-next-line import/order
1516
const { getRequestHandlers } = require('next/dist/server/lib/start-server.js')
1617
const requiredServerFiles = require('../../.next/required-server-files.json')
1718

19+
// read Next config from the build output
1820
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(requiredServerFiles.config)
19-
2021
const nextConfig = requiredServerFiles.config as NextConfigComplete
2122

23+
// run the server in the root directory
2224
const __dirname = fileURLToPath(new URL('../..', import.meta.url))
23-
2425
process.chdir(__dirname)
2526

27+
// memoize the node bridge instance
2628
let bridge: Bridge
2729

2830
export const handler: Handler = async function (event: HandlerEvent, context: HandlerContext) {

0 commit comments

Comments
 (0)