-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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(@react-router/dev): add defineConfig
utility
#12541
base: dev
Are you sure you want to change the base?
Conversation
|
defineConfig
utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We went back and forth on whether to add this, but we ultimately decided against it because it adds needless indirection, even though the syntax does look nicer to my eyes.
A defineConfig
function arguably makes it look like there's some kind of runtime behaviour supported here, or that it may be introduced in the future, but if it's only used to perform type checking, it felt simpler and more transparent to simply annotate the type.
Curious to hear your thoughts on this though.
@rossipedia pinging you so you can leave thoughts as well, but here are mine: I think this is more of a "standards" thing in my eyes, as the react-router plugin relies on Vite, and wraps it with with a custom command I'd expect for it to have similar config definition to Vite, something like Vitest does, I understand they integrate tightly and are built by the same people, but I feel like this function definition has become something you expect to see in the Vite ecosystem. Another thing I'd like to mention is that there are certain config flags, even though they don't provide import { defineConfig } from "@react-router/dev/config";
export default defineConfig({
vite: {
// ... vite stuff here ...
},
future: {
// RSC WHEN?!?!?
}
}) I personally feel like it's just a convinience 1 liner utility that feels warm and familiar compared to 1 million custom configs like eslint, biome, insert random json config file here. It takes 0 maintainence as it just inherits the type you have to define and manage anyway and it feels more in line with Vite. |
Create a
vite
styledefineConfig
so you can do something like: