UNPKG

@mintlify/previewing

Version:

Preview Mintlify docs locally

23 lines (22 loc) 1.31 kB
/** * When creating a standalone build, next.js outputs a server.js file that can be used as * an entry point into the server. However, because we want to customize some parts of the * http server (adding a socket.io server, serving the whole public directory), we * create the server ourselves, and just reproduce the setup that next.js would do. * * Because we need to directly import from node_modules files, this solution seems very hacky, * but it is arguably no more hacky than using the server.js that ships with the standalone * build. * * This function attempts to replicate the behavior of two next.js files: * - environment setup from server.js * - initialization of the request handler from start-server.ts * * Links: * - [standalone build](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files) * - [server.js](https://github.com/vercel/next.js/blob/492156b4c5e2559b2a280f7d483cd85a8e8742a9/packages/next/src/build/utils.ts#L2108-L2113) (created programmatically) * - [start-server.ts](https://github.com/vercel/next.js/blob/59e5ccb225189d366f57f1b204c5f44053a434ce/packages/next/src/server/lib/start-server.ts#L416-L429) * * @returns the request handler provided by next.js */ export declare const setupNext: () => Promise<any>;