Skip to content

Conversation

@nahyeongjin1
Copy link

@nahyeongjin1 nahyeongjin1 commented Dec 29, 2025

Description

The plugin was overwriting the entire rollup.input config during SSR build, which removed entries set by other plugins.
This caused react-router v7's prerender feature to fail because the server-build entry was being removed.

This PR fixes the issue by preserving existing rollup input entries and merging them with the Netlify function handler entry.
The fix handles all possible input formats:

  • String input
  • Array input
  • Object input

Additionally, this PR enables the previously skipped prerender e2e tests for both serverless and edge sites, which were disabled due to this bug (referenced in React Router issue #13226).

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Reproduction Steps

  1. Create a new project using the official Netlify template:
npx create-react-router@latest --template netlify/react-router-template
  1. Navigate to the project folder (default: my-react-router-app)

  2. Replace react-router.config.ts with:

import type { Config } from "@react-router/dev/config";

export default {
  ssr: true,
  future: {
    v8_middleware: true,
  },
  async prerender() {
    return ["/"];
  },
} satisfies Config;
  1. Run the build:
npm install && npm run typecheck && npm run build

Before this fix

Build fails with:

✗ Build failed in 283ms
[react-router] Server build file not found in manifest

After this fix

Build succeeds with prerender working:

build/server/server.js                         0.35 kB
build/server/assets/server-build-lv_U4l46.js  14.57 kB   ← preserved

Prerender (html): / -> build/client/index.html
✓ built in 292ms

For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This
    ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a
    typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style
    guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)
🦊

@nahyeongjin1 nahyeongjin1 requested a review from a team as a code owner December 29, 2025 05:35
@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for remix-edge ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 195d62a
🔍 Latest deploy log https://app.netlify.com/projects/remix-edge/deploys/695e32fa71be8e0008596196
😎 Deploy Preview https://deploy-preview-607--remix-edge.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for remix-serverless ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 195d62a
🔍 Latest deploy log https://app.netlify.com/projects/remix-serverless/deploys/695e32fa71be8e0008596192
😎 Deploy Preview https://deploy-preview-607--remix-serverless.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

The plugin was overwriting the entire rollup input config, which removed entries set by other plugins (e.g., react-router's prerender server-build).
Now it merges existing input entries with the Netlify function handler entry.
- Enable previously skipped prerender tests for both serverless and edge sites.
- The tests were disabled due to React Router issue #13226, but now work correctly after the rollupOptions.input merge fix in plugin.ts.
@nahyeongjin1 nahyeongjin1 force-pushed the fix/preserve-existing-rollup-input branch from b76352e to 195d62a Compare January 7, 2026 10:18
@nahyeongjin1
Copy link
Author

Hi! I've added e2e tests that enable the previously skipped prerender tests.
Could someone take a look when you have time? Happy to make any changes if needed.

@nahyeongjin1 nahyeongjin1 changed the title fix: preserve existing rollup input entries during SSR build fix(vite-plugin-react-router): preserve existing rollup input entries during SSR build Jan 7, 2026
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

Successfully merging this pull request may close these issues.

[BUG] rollupOptions.input overwrite breaks React Router prerender

1 participant