remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
53.28k stars 10.33k forks source link

Vite plugin does not accept options #12352

Open jgarplind opened 5 days ago

jgarplind commented 5 days ago

Describe what's incorrect/missing in the documentation

https://reactrouter.com/upgrading/router-provider#2-install-the-vite-plugin describes how to adopt the new React Router framework, coming from RouterProvider.

I started this migration, but ran into issues when I realized that the reactRouter plugin does not accept the same options as the react plugin, which stopped me in my tracks.

Specifically, I have the need to add babel plugins both for React compiler: https://react.dev/learn/react-compiler#usage-with-vite and Lingui: https://lingui.dev/tutorials/setup-vite.

In Discord, Kosire suggested I could patch the plugin: https://discord.com/channels/770287896669978684/1309472866453946368/1309472866453946368, which would probably work, but is not very accessible to the average user of the library, and would also be a significant maintenance burden over time, so it's not something I would like to do without being sure it is the only way.

Is this the state of things? Or is there a more appropriate way to handle this scenario, which could then be added to the documentation?

timdorr commented 5 days ago

Currently, it takes no options, so that would be the place to start. Unfortunately, it doesn't look like an easy task.

jgarplind commented 5 days ago

Thanks for weighing in! Yeah, that much is clear from looking at the source code. Whether it is an easy task or not is harder for me to tell.

I'm not sure why/if it would be difficult to accept the same arguments as the react-plugin (or at least the babel option). I wrote this issue hoping it was more or less forgotten, but of course it seems more likely that there are legitimate technical reasons.

romulovalez commented 4 days ago

I also need to pass the babel option in order to use styled-components, so I think is a must for a lot of users

faradaytrs commented 3 days ago

We also need babel options because we are using react compiler