Skip to content

Instantly share code, notes, and snippets.

@reysmerwvr
Last active March 29, 2022 20:20
Show Gist options
  • Save reysmerwvr/66ff7fe32f47f842b50ef63db07f3298 to your computer and use it in GitHub Desktop.
Save reysmerwvr/66ff7fe32f47f842b50ef63db07f3298 to your computer and use it in GitHub Desktop.
Fix Not Found Page on Remix.run Deployment in Vercel

How to change from Remix App Server configuration to Vercel configuration

Remix.run version: 1.1.3

  1. Make sure that your remix.config.js file looks like this:
/**
 * @type {import('@remix-run/dev/config').AppConfig}
 */
module.exports = {
  appDirectory: 'app',
  assetsBuildDirectory: 'public/build',
  publicPath: '/build/',
  serverBuildDirectory: 'api/_build', // original value 'build'
  devServerPort: 8002,
  ignoredRouteFiles: ['.*'],
}
  1. Make sure to add Vercel dependency in your package.json doing:
npm i @remix-run/vercel
  1. Create api/index.js at the root directory of your project with the following content:
const { createRequestHandler } = require("@remix-run/vercel");

module.exports = createRequestHandler({
  build: require("./_build")
});
  1. Remember to ignore the output directory /api/_build in your .gitignore by adding the following line:
/api/_build

That's all! I hope this helps you out with the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment