-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
In one of the projects I'm working on, we are in the process of migrating our bundler from Webpack to Rspack.
Rspack is a bundler based on Rsbuild, written in Rust. It is extremely fast and aims to be compatible with the Webpack ecosystem.
However, it is not perfect yet. Some plugins have not been ported or are simply incompatible. There are also some memory usage bugs with the development server (this is almost all fixed). Despite these challenges, I believe Rspack will become a great option in the coming months.
Our team decided to evaluate another bundler because Webpack takes 40 seconds or more to compile our project (which is quite complex).
Rspack, on the other hand, completes the same task in 2 to 6 seconds.
Rationale
Reducing compilation time is always good, and makes development more fluid.
Pros:
- It is currently very fast, making the development process smoother.
- It can coexist alongside the Webpack configuration, as long as you create separate run commands in
package.json
. - The rspack configuration is structurally very similar and has the same arguments etc as webpack, so it's pretty close to a 1:1 port... okay, maybe 75% of that.
Cons:
- It only recently reached version 1.0, so it is still not very stable.
- Not all widely used Webpack plugins have been ported to Rust yet (although it is still possible to use the original JavaScript plugins).
Since Rspack is relatively new, I'm not so sure if django's ecosystem of libraries to integrate with webpack already has support for it, like django-webpack-loader
A few key definitions:
- Rsbuild: The build tool that is compatible with the Webpack ecosystem.
- Rspack: The bundler based on Rsbuild, designed for specific JavaScript frameworks such as React, Vue, Svelte, Next.js, etc.
- Rsdoctor: An analyzer for visualizing the build process and build artifacts.
For more details, see the migration guides:
Rspack Migration from Webpack Guide: https://rspack.dev/guide/migration/webpack
Rspack plugin compatibility table: https://rspack.dev/guide/compatibility/plugin
Rsbuild Migration from Webpack Guide: https://rsbuild.dev/guide/migration/webpack
Rsbuild ported plugins: https://rsbuild.dev/plugins/list/index