Skip to content

vite config ssr.noExternal = true causing vercel edge runtime deployment to fail. #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aidenlx opened this issue Mar 20, 2025 · 0 comments

Comments

@aidenlx
Copy link

aidenlx commented Mar 20, 2025

vite config ssr.noExternal = true causes Vercel edge runtime deployment to fail

Problem Description

When using the official React Router v7 Vercel template with Edge runtime, setting ssr.noExternal = true in the vite.config.ts file causes deployment failures on Vercel with the following error:

Error: The Edge Function "index" is referencing unsupported modules:
- __vc__ns__/0/build/server/edge_eyJydW50aW1lIjoiZWRnZSJ9/index.js: node:stream, crypto, stream

This configuration appears in the official template at: https://github.com/remix-run/react-router-templates/blob/4c84712c10c6189a2770320e0e916559ee87eca5/vercel/vite.config.ts

Reproduction

  1. Create a new React Router v7 project using the Vercel template
  2. Configure Edge runtime with export const config = { runtime: "edge" }
  3. Deploy to Vercel
  4. Observe the deployment error related to unsupported Node.js modules

How to Fix

Removing the following configuration from vite.config.ts resolves the issue:

ssr: { 
  noExternal: command === "build" ? true : undefined, 
},

Supporting Information

Environment

  • React Router v7
  • Vercel deployment platform
  • Edge runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant