Skip to content
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

feat(@netlify/build-info): add React Router 7 detection #5930

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

serhalp
Copy link
Contributor

@serhalp serhalp commented Dec 9, 2024

Summary

React Router 7 was released a couple weeks ago. It's sort of the next version of Remix and also sort of the next version of React Router. It can be used as a library or as a framework.

Thus, this adds it to our framework detection, but only for version 7+.

There are some oddities here:

  • Technically we can't know if the user is using "framework mode" or "library mode", so we'll assume framework mode and let the user override the dev/build commands otherwise 🤷🏼
  • Technically we'd want to add react-router to Vite's excludedNpmDependencies, but we actually only want to exclude RR >=7 (many RR <7 users will be using Vite or something else, so we don't want to break that).
    • But everything works fine if we just don't do anything here, since frameworks get priority over bundlers when there are multiple matches (I'm not really sure why we both excluding Vite frameworks in the Vite logic), and the code to do this right would be a bit gross.

@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch from bfe95a3 to d6c7af4 Compare December 10, 2024 20:43
@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch from d6c7af4 to 820bd41 Compare December 10, 2024 21:30
Technically we'd want to add it to Vite's `excludedNpmDependencies`, but we actually only
want to exclude RR >=7. Many RR <7 users will be using Vite, so we don't want to break
that.

But everything works fine if we just don't do anything here, since frameworks get priority
over bundlers when there are multiple matches. (I'm not really sure why we both excluding
Vite frameworks in the Vite logic).
@serhalp serhalp force-pushed the serhalp/frb-1511-support-react-router-7 branch from 820bd41 to a75b85a Compare December 10, 2024 21:33
@serhalp serhalp marked this pull request as ready for review December 10, 2024 21:33
@serhalp serhalp requested a review from a team as a code owner December 10, 2024 21:33
readonly id = 'react-router'
name = 'React Router'
configFiles = ['react-router.config.ts', 'react-router.config.js']
npmDependencies = ['react-router']
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to detect the plugin we built as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants