ThecomposePlugins function takes a list of plugins and a function, and returns a Rspack Configuration object. The composePlugins function is an enhanced version of the Rspack configuration function, which allows you to add plugins to the configuration, and provides you with a function which accepts two arguments:
In addition to the basic configuration, you can add configurations for other frameworks or features. The @nx/rspack package provides plugins such as withWeb and withReact. This plugins provide features such as TS support, CSS support, JSX support, etc. You can read more about how these plugins work and how to use them in our Rspack Plugins guide.
For most apps, the default configuration of Rspack is sufficient, but sometimes you need to tweak a setting in your Rspack config. This guide explains how to make a small change without taking on the maintenance burden of the entire Rspack config.
Woovi developers usually work on 3 of these frontends: woovi, login, and console.
They would need to start 3 different terminals and run 3 different commands to be started.
We combined these 3 commands in a single command that will run all these 3 rspack processes.
The processes would consume a lot of CPU and memory.
To solve these problems and simplify our workflow.
We improved the config to run these 3 frontends at the same time using the same rspack, reducing CPU and memory usage.
Here is the final config:
The entry field defines entry points for rspack.
For each entrypoint it will generate one or more chunks based on code splitting.
devServer.historyApiFallback.rewrites will teach devServer to redirect any request to the correct index.html as our app is a SPA without a server
We also need one HtmlWebpackPlugin for each frontend, each generated HTML has only its specific chunk
3a8082e126