T
TanStackโ€ข16mo ago
conscious-sapphire

Any plugins for rspack or webpack support?

Hi - we are currently checking out this cool looking router โค๏ธ We are currently considering it for the PlatformPlatform project but we are on rspack - any official plugins or is the cli devtool the way to go? Thank you ๐Ÿ™‚ Kind regards Morten
15 Replies
wise-white
wise-whiteโ€ข16mo ago
not yet we were looking into unplugin, however the rspack support seems not to be that great (watching is not supported for example)
conscious-sapphire
conscious-sapphireOPโ€ข16mo ago
I did create a simple filesystem router for generating react router as a rspack plugin - watch is possible: https://github.com/platformplatform/PlatformPlatform/blob/main/application/client-foundation/clientFilesystemRouter/rspack-plugin.ts
GitHub
PlatformPlatform/application/client-foundation/clientFilesystemRout...
๐Ÿš€ Pre-alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc. - platformplatform/PlatformPlatform
wise-white
wise-whiteโ€ข16mo ago
Unplugin
Unified plugin system. Support Vite, Rollup, webpack, esbuild, and every frameworks on top of them.
wise-white
wise-whiteโ€ข16mo ago
so if you have experience you are more than welcome to contribute!
conscious-sapphire
conscious-sapphireOPโ€ข16mo ago
Seems correct that unplugin doesn't have support for it yet - I can make a pull-request or we can wait until rspack / unplugin are ready, up to you ๐Ÿ™‚ (just hoped that it already existed ๐Ÿ˜… )
wise-white
wise-whiteโ€ข16mo ago
we are trying to get unplugin into our repo, based on https://github.com/TanStack/router/discussions/975#discussioncomment-9766529
GitHub
V2 ยท TanStack router ยท Discussion #975
Moving away from classes Classes are great for defining types and functionality in one go, but they're not very friendly to destructuring and compositional/functional APIs. The following change...
wise-white
wise-whiteโ€ข16mo ago
if you can help out, would be great!
conscious-sapphire
conscious-sapphireOPโ€ข16mo ago
super, I'll have a look - seems like unplugin could be a starting point
curly-silver
curly-silverโ€ข15mo ago
Yup, this something I'll also be looking into next week. Current plan is to introduce a @tanstack/router-plugin package with exports like @tanstack/router-plugin/vite, @tanstack/router-plugin/webpack, etc. And have the @tanstack/router-vite-plugin simply re-export from @tanstack/router-plugin/vite. Would have to make sure the Start stuff gets extracted out first though.
curly-silver
curly-silverโ€ข15mo ago
Tracking this here: https://github.com/TanStack/router/issues/1756 I'm going to first make the migration and then work on getting webpack up and running since its currently fully supported by unplugin. But once this goes through, the process of setting up the rspack export should be much more trivial.
GitHub
migrating to unplugin for making the router-plugin compatible wit...
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 plugin package ...
Unplugin
Unified plugin system. Support Vite, Rollup, webpack, esbuild, and every frameworks on top of them.
conscious-sapphire
conscious-sapphireOPโ€ข15mo ago
awesome, let me know if you need help testing etc. or if somethings blocking you etc. anything I can do to help out ๐Ÿ™‚
curly-silver
curly-silverโ€ข15mo ago
the router-plugin has been moved over to unplugin. going to work on getting another plugin out within the next couple days with a working example.
conscious-sapphire
conscious-sapphireOPโ€ข15mo ago
Awesome work! ๐Ÿ™‚
curly-silver
curly-silverโ€ข15mo ago
looks like i'll be tackling rspack today... purely because they actually a barebones react-starter ๐Ÿ˜… The rspack plugin for route generation is out! Still no support for the experimental code-splitting stuff, but that's for an older me to tackle.
conscious-sapphire
conscious-sapphireOPโ€ข15mo ago
@Sean Cassiere I'll test the plugin on PlatformPlatform - I'm not into the details regarding code splitting resolveId/transform but I did have a version of our rspack plugin transforming code - not sure if it's helpful https://github.com/platformplatform/PlatformPlatform/blob/a369e865041639948f4f313a24fc5feecef86af1/application/client-foundation/clientFilesystemRouter/rspack-plugin.ts#L35

Did you find this page helpful?