Skip to content

Conversation

@korkt-kim
Copy link

@korkt-kim korkt-kim commented Jan 21, 2026

Description

When using basename in react-router.config.ts, prerendered files are incorrectly output to a subfolder matching the basename (e.g., build/client/base/index.html instead of
build/client/index.html).

The basename is meant to define the deployment path prefix, not the build output directory structure. The prerender logic was using normalizedPath (which includes basename)
instead of the actual route path for determining output file locations.

Changes

  • Use dataRequestPath instead of normalizedPath for .data file output paths
  • Use prerenderPath instead of normalizedPath for HTML file output paths
  • Use prerenderPath instead of normalizedPath for resource route output paths
  • Add test for prerender with basename configuration

Impact

No compatibility issues - This is a bug fix that corrects the output path behavior. Previously, prerendered files with basename would be placed in wrong directories, causing
404 errors when deployed.

Fixes #14587

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 21, 2026

Hi @korkt-kim,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 6a652d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@react-router/dev Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch
react-router Patch
react-router-dom Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@korkt-kim korkt-kim changed the base branch from main to dev January 21, 2026 04:37
@korkt-kim korkt-kim force-pushed the fix/prerender-path branch 4 times, most recently from e458b55 to 667d299 Compare January 21, 2026 04:50
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 21, 2026

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@korkt-kim korkt-kim changed the title fix: prerender output paths should not include basename (#14587) fix: prerender output paths should not include basename Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants