Skip to content

fix(dev): improve server build asset handling #13547

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

Merged

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented May 7, 2025

We currently log a message during the build when moving assets from the server build to the client, but we weren't logging anything when cleaning server assets that already exist in the client build. This led to some confusion because Vite logs that these files were generated, but after the build has finished the assets are no longer there.

To avoid this confusion, we now log whenever assets are handled in any way, not just when they're moved.

While working on this, I also realised that we don't honour the consumer's build.ssrEmitAssets option if they explicitly want to keep these assets, so the logic and logging has also been updated to account for this.

Before:
Screenshot 2025-05-07 at 11 32 08 am

After:
Screenshot 2025-05-07 at 11 30 23 am

Copy link

changeset-bot bot commented May 7, 2025

🦋 Changeset detected

Latest commit: e35e15f

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

@MichaelDeBoey MichaelDeBoey changed the title Improve server build asset handling fix(dev): improve server build asset handling May 7, 2025
@markdalgleish markdalgleish merged commit dd3fb69 into dev May 8, 2025
8 checks passed
@markdalgleish markdalgleish deleted the markdalgleish/improve-server-build-asset-handling branch May 8, 2025 00:09
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