import { defineConfig } from '@rsbuild/core';
import { pluginReactRouter } from 'rsbuild-plugin-react-router';
import { pluginReact } from '@rsbuild/plugin-react';
export default defineConfig(() => {
return {
plugins: [
pluginReactRouter({
// Optional: Enable custom server mode
customServer: false,
// Optional: Specify server output format
serverOutput: "commonjs",
//Optional: enable experimental support for module federation
federation: false
}),
pluginReact()
],
};
});
I did a small search on the forum, and was never mentioned @rsbuild, I assume we(meteor) do the part of the rsbuild, how could this config be in my meteor case?
This is an interesting use case. However, React Router framework mode does not seem to have direct support for Rspack (the engine), only for Rsbuild (a friendly builder on top of the engine).
Rspack = the fast, Webpack-compatible bundler (the engine).
Rsbuild = the nice developer-friendly build tool on top of Rspack (the whole car).
And that’s why you can’t drop something like:
pluginReactRouter() pluginReact()
into a plain Rspack config, those are Rsbuild plugins, not Rspack plugins.
They only work because Rsbuild has its own plugin system and then generates Rspack config behind the scenes.
If you want that same behavior in pure Rspack, you’d have to get the Rsbuild plugin’s source, see what Rspack settings it creates, and copy that setup manually. Or wait or request that in the official React Router repository to have also a proper rspack engine support.
Anyway, finding a way to use Rsbuild plugins with Rspack is something I would be interested in exploring. There may be ways to automate it. I suggest moving this into a separate forum post to start a focused experimentation process.
Btw, using react-router in NPM library mode is entirely possible. Only this framework mode which gets closer to the bundler requires advanced setup.