Skip to content

Conversation

@joseph0926
Copy link
Contributor

Description

When using a CDN with CORS headers, CSS files loaded via the <Links> component can fail due to browser cache behavior.

After #14463, React Router appends # suffix to CSS hrefs for dynamic imports. This causes Vite to make a separate request (since URLs differ), but both requests share the browser cache. If React Router's <link> lacks crossOrigin while Vite's has crossOrigin="anonymous", the cached response (without CORS headers) fails Vite's CORS check.

Changes

  • Add crossOrigin prop to LinksProps interface
  • Pass crossOrigin to <link> elements in Links component
  • Add tests for crossOrigin behavior

Impact

  • Probably no compatibility issues -> Because it was applied selectively via properties

Fixes #14678

@changeset-bot
Copy link

changeset-bot bot commented Dec 26, 2025

🦋 Changeset detected

Latest commit: d932159

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 Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router 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

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.

1 participant