Skip to content
Discussion options

You must be logged in to vote

I'd keep @react-router/dev in devDependencies and check whether a runtime module imports one of your route-config files, directly or through a barrel export.

Splitting the configuration across files is fine. In Framework Mode, the route configuration describes which route modules to build. A loader, component, or other runtime module importing that configuration introduces a separate dependency on the helpers used to construct it.

I tested a small app with React Router / @react-router/dev 8.4.0, Vite 8.3.0 and React 19.3.0:

  • app/routes.ts imported a separate settings config using index() and prefix(). The server build had no @react-router/dev/routes import and loaded successfully after np…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ShahriarKh
Comment options

Answer selected by ShahriarKh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants