-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Currently, the router plugin is only available for vite. This leaves people who use bundlers like webpack and rollup having to install the @tanstack/router-cli package and run it every time they start up their dev server. This is not the most optimal experience. Additionally, it also makes features like experimental.enableCodeSplitting only available to the vite users.
The intention here is to begin the migration to using unplugin so the router plugin can be made available for other bundlers like webpack, rspack, etc. in the future.
Currently, the router plugin packages are:
@tanstack/router-generator@tanstack/router-cli@tanstack/router-vite-plugin
And by the end of this migration, it should be:
@tanstack/router-generator@tanstack/router-cli@tanstack/router-plugin@tanstack/router-vite-plugin@tanstack/start-vite-plugin
For this task to be considered complete, the following milestones need to be achieved.
Note
Each of these major tasks (like 1, 2, ...), should go through in separate PRs to make reverts easier, whilst minor tasks (like 2.1, 2.2, ...) would be batched together under their respective majors.
### Migration tasks
- [x] 1. Copy the **Start** specific logic (currently that's the babel stuff appending `"use server"` to the `createServerFn` calls) into its own `@tanstack/start-vite-plugin` package. (#1768)
- [x] 2. Remove the logic that's in the new `@tanstack/start-vite-plugin` package from the existing`@tanstack/router-vite-plugin` package. (#1771)
- [x] 3. Create the new `@tanstack/router-plugin` package. (#1778)
- [x] 3.1 Copy the existing `router-vite-plugin` logic (minus the Start stuff) into a new package named `@tanstack/router-plugin` that uses [unplugin](https://unplugin.unjs.io/).
- [x] 3.2 Make sure the new `@tanstack/router-plugin` package exports the relevant vite plugins from `@tanstack/router-plugin/vite`.
- [x] 4. Refactor `@tanstack/router-vite-plugin` package to simply be a proxy, re-exporting from `@tanstack/router-plugin/vite` and the root. (#1785)
- [x] 5. Update the documentation to show the vite plugin setup using `@tanstack/router-plugin/vite`. This'll be a non-breaking change for anyone using `@tanstack/router-vite-plugin`. (#1793)
- [x] 6. Setup the `rspack` export. (#1794)
- [x] 6.1 Setup `@tanstack/router-plugin` with a webpack export (`@tanstack/router-plugin/rspack`).
- [x] 6.2 Documentation for setting up TanStack Router using the rspack plugin.
- [x] 6.3 (optional) setup an example with TanStack Router using rspack.
For now, I've included rspack as the only bundler we're targeting to support next. The plugins for the other bundlers can be added in the future either through community contributions or when maintainers get more bandwidth 😅.