Files
vercel/packages/remix/defaults/vercel-edge-entrypoint.js
Nathan Rajlich 13d54b2095 [remix] Support optional entry.{server,client}.tsx file (#9620)
Remix v1.14.0 added support for having no `app/entry.server.tsx`/`app/entry.client.tsx` files in a project (there are default versions bundled into `@remix-run/dev`). Projects configured like this are currently failing because we symlink our forked version of the `remix` CLI into the project, so it cannot resolve the necessary modules at build time.

To solve this, instead of relying on the default versions of these files in `@remix-run/dev` package, we'll include our own versions in `@vercel/remix`, and physically copy them into the project dir. This way, the modules used will be properly resolved relative to the project's own `node_modules` dir.

Our default version of `app/entry.server.tsx` is also slightly different then upstream one, because it uses `@vercel/remix-entry-server` to enable isomorphic React streaming on both Node + Edge runtimes. Because of this, if that dependency is not present, then we'll automatically install the dependency at build-time.
2023-03-13 20:47:56 +00:00

22 lines
540 B
JavaScript

/**
* Edge runtime entrypoint for `@remix-run/vercel`.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var serverRuntime = require('@remix-run/server-runtime');
/**
* Returns a request handler for the Vercel Edge runtime that serves
* the Remix SSR response.
*/
function createRequestHandler({ build, mode }) {
let handleRequest = serverRuntime.createRequestHandler(build, mode);
return request => {
return handleRequest(request);
};
}
exports.createRequestHandler = createRequestHandler;