Skip to content

Conversation

brillout
Copy link

Add support for Vite plugins that add a server build entry. For example, this change is required for being able to use React Router with Telefunc.

Copy link

changeset-bot bot commented Sep 18, 2025

⚠️ No Changeset found

Latest commit: f3c0d27

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Sep 18, 2025

Hi @brillout,

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 hello@remix.run.

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Sep 18, 2025

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

@brophdawg11
Copy link
Contributor

Can you open an issue with a minimal reproduction that we can use to see the issue and validate the fix? Or, if it's possible to write a small E2E test with a vite plugin that demonstrates this issue that's even better - but if that's tricky or it needs to pull in a third party, let's just open an issue with a repro instead of pulling a third party into the E2E test.

@brillout
Copy link
Author

Reproduction: https://github.com/brillout/telefunc-react-router/tree/repro

@brillout
Copy link
Author

Bug report: #14352

@brillout
Copy link
Author

if it's possible to write a small E2E test

I ain't sure how to easily reproduce this without adding a Telefunc dependency to React Router's monorepo.

output: {
entryFileNames: serverBuildFile,
entryFileNames({ name }) {
return name === "virtual_react-router/server-build"
Copy link
Contributor

@pcattori pcattori Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For onlookers: our server build virtual module (virtual:react-router/server-build) gets sanitized via Rollup's sanitizeFilename which replaces the : with _

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some tests are failing because the name ends up being server-build rather than virtual_react-router/server-build

Copy link
Contributor

@pcattori pcattori Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brillout was virtual_react-router/server-build working for you? I just changed it to server-build and now most tests are passing for me locally. Trying to figure out when we should expect virtual_react-router/server-build vs just `server-build.

Suggested change
return name === "virtual_react-router/server-build"
return name === "server-build"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the reproduction I linked to, the name is virtual_react-router/server-build. Maybe name === "server-build" || name === "virtual_react-router/server-build" or name.endsWith("server-build") then?

Btw. I guess this change should also be applied to other entryFileNames usage. I just did the minimal amount of changes to fix the reproduction. (I'm inclined to think it's better the React Router team takes over the PR.)

@rossipedia
Copy link
Contributor

🥳 I would love to be able to supply entry files (and event root.tsx) as a vite plugin. We have several apps that use common entries and root routes, abstracting that away is a bit tedious as long as React Router requires root.tsx and the entry.*.tsx files to exist on disk at specific locations.

@remix-run remix-run deleted a comment from Samiullahstanikzai Sep 28, 2025
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.

4 participants