Skip to content

feat: add @netlify/vite-plugin-react-router to support React Router 7 #472

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
merged 7 commits into from
Dec 13, 2024

Conversation

serhalp
Copy link
Contributor

@serhalp serhalp commented Dec 5, 2024

Description

Remix has converged with React Router and the "next version" of Remix was released as React Router 7.

This PR adds a new package to support React Router 7: @netlify/vite-plugin-react-router. The naming convention is different as this is purely a Vite plugin (previous "adapters" also supported the Remix Classic Compiler), so we were able to follow the documented naming convention.

Future work

  • This does not yet add support for edge rendering.
  • An upgrade/migration guide from Remix 2 is coming soon
  • The plugin source is 95% duplicated from @netlify/remix-adapter. We should probably refactor to extract the shared logic.

Related Tickets & Documents

FRB-1511

Supersedes #471

See also netlify/remix-template#157

QA Instructions, Screenshots, Recordings

This PR adds extensive e2e tests.

I also added a new React Router Netlify template here: netlify/react-router-template#1. It uses this new plugin, and you can see the successful deploy preview there.

Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for remix-serverless ready!

Name Link
🔨 Latest commit a1f5d1d
🔍 Latest deploy log https://app.netlify.com/sites/remix-serverless/deploys/675b714361c324000891c47d
😎 Deploy Preview https://deploy-preview-472--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 site configuration.

Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for remix-edge ready!

Name Link
🔨 Latest commit a1f5d1d
🔍 Latest deploy log https://app.netlify.com/sites/remix-edge/deploys/675b7143a5319800085520be
😎 Deploy Preview https://deploy-preview-472--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 site configuration.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Dec 5, 2024
@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch 2 times, most recently from 176717d to 95339a7 Compare December 10, 2024 15:30
@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch from 95339a7 to 5a4d475 Compare December 10, 2024 21:43
@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch from 5a4d475 to c0203ab Compare December 10, 2024 23:11
@serhalp serhalp changed the title feat: add @netlify/react-router-adapter to support React Router 7 feat: add @netlify/vite-plugin-react-router to support React Router 7 Dec 10, 2024
@@ -67,14 +67,12 @@
"@remix-run/react": "^2.12.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"lambda-tester": "^4.0.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was unused

},
"peerDependencies": {
"@netlify/functions": "^2.8.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this was ever relevant, or at least it isn't currently

"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^8.0.2",
"vite": "^5.1.3"
"vite": "^5.4.11"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to upgrade this to resolve some type issues caused by having multiple versions of vite in the workspace.

@@ -0,0 +1,247 @@
import { expect, test } from './support/fixtures'

test.describe('React Router user journeys', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are almost identical to the Remix e2e tests. We only changed a few strings like "Welcome to Remix", etc.

@serhalp serhalp marked this pull request as ready for review December 10, 2024 23:22
@serhalp serhalp requested a review from a team as a code owner December 10, 2024 23:22
@mrstork mrstork mentioned this pull request Dec 11, 2024
5 tasks
@serhalp serhalp requested a review from mrstork December 12, 2024 23:29
Copy link
Contributor

@mrstork mrstork left a comment

Choose a reason for hiding this comment

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

Nice!

@serhalp serhalp merged commit aeeb979 into main Dec 13, 2024
15 checks passed
@serhalp serhalp deleted the serhalp/frb-1511-support-react-router-7 branch December 13, 2024 14:37
serhalp added a commit that referenced this pull request Dec 13, 2024
Added in #472 but didn't realize there was a config file to update!
serhalp added a commit that referenced this pull request Dec 13, 2024
* ci(release-please): add new package to config

Added in #472 but didn't realize there was a config file to update!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants