Skip to content

Commit

Permalink
feat: support React Router 7 in react-refresh rules (#652)
Browse files Browse the repository at this point in the history
oltodo authored Jan 9, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent de2d48d commit 1a41e55
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/configs/react.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,12 @@ const RemixPackages = [
'@remix-run/serve',
'@remix-run/dev',
]
const ReactRouterPackages = [
'@react-router/node',
'@react-router/react',
'@react-router/serve',
'@react-router/dev',
]
const NextJsPackages = [
'next',
]
@@ -57,6 +63,7 @@ export async function react(

const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(i => isPackageExists(i))
const isUsingRemix = RemixPackages.some(i => isPackageExists(i))
const isUsingReactRouter = ReactRouterPackages.some(i => isPackageExists(i))
const isUsingNext = NextJsPackages.some(i => isPackageExists(i))

const plugins = pluginReact.configs.all.plugins
@@ -125,7 +132,7 @@ export async function react(
'generateViewport',
]
: []),
...(isUsingRemix
...(isUsingRemix || isUsingReactRouter
? [
'meta',
'links',

0 comments on commit 1a41e55

Please sign in to comment.