Rspack Recently Was Awarded Breakthrough of the Year at JSNation

Bookmark
Rate this content

For those who have not heard of Rspack, it's a 1:1 port of Webpack to Rust.

But, did you know that rspack is actually the 4th iteration of native bundlers our team has designed, and it originally started out as a plugin for esbuild. In its development, we have rewritten esbuild & rollup in rust, taken apart parcel to understand it better, and overall have reviewed every bundler on the market during the development of rspack before finally picking the webpack api design for the project as it is known today.


In this talk I will share the behind the scenes of its creation, why we built it, what the future for rspack looks like, and our own experience + business data we have gathered with it in supermassive projects at ByteDance.

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

FAQ questions should align with search terms to enhance visibility in search engine results and improve the chances of being featured as snippets.

The purpose of this FAQ section is to provide concise and informative question-answer pairs that capture the most important and relevant information from the content.

The FAQ section can improve SEO by aligning with common user queries and search terms, aiming to appear as featured snippets in search engine results.

An important feature of the FAQ content is its ability to provide concise and relevant information that addresses common user queries.

The FAQ section aims to improve search result visibility by answering common queries in a concise manner, making it more likely to be featured in search snippets.

Zack Jackson
Zack Jackson
31 min
18 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Talk discussed RSPack, a Rust rewrite of Webpack that won Breakthrough of the Year at JS Nation. RSPack was developed at ByteDance to address the complexities of their WebInfra and provide a suitable bundler for native and exotic environments. The development of RSPack focused on improving on ES Build's capabilities, reducing CI wait times, and maximizing product velocity. ESBuild and Webpack had various weaknesses and limitations, leading to the decision to create a new bundler architecture. RSPack aimed to be language-agnostic and prioritize artifact integrity, performance, productivity, and business value. API design emphasized a balance between performance and versatility, tailored for larger businesses. RSPack achieved significant reductions in cloud costs and build times, and future ideas include TypeScript optimization and remote caching. For smaller companies, considerations when choosing a bundler include performance, chunking, reliability, and user experience.

1. Introduction to RSPack

Short description:

Today, I will talk about RSPack, a Rust rewrite of Webpack that won Breakthrough of the Year at JS Nation. I will discuss the rationale behind its creation.

♪♪♪ Alright, well, thank you for coming to my talk. Okay, so first, does anybody know what RSPack is? I can't see anybody, so... Okay, cool. So, somebody does. For those of you that don't know what it is, it's essentially a Rust rewrite of Webpack that we ended up doing. So, really, what I'm going to talk to you today, since I'm at JS Nation, the Amsterdam conference, RSPack actually won Breakthrough of the Year, so I thought this would be a fantastic opportunity to speak a little bit about the rationale behind creating it.

2. WebInfra at ByteDance and the Origins of RSPack

Short description:

WebInfra at ByteDance supports a vast set of tools and frameworks to unify the DX of everything into central solutions. The complexity and scope of responsibility are much larger compared to open-source projects. On-call obligations are high, with a quick response and resolution time. Writing a custom bundler became necessary due to the complexities and the need for a suitable solution that works well with native and exotic environments. RSPack originated from Link Speedy, an in-house cross-platform development solution.

So, just a little bit of context into what WebInfra at ByteDance looks like in terms of its scale is, one, we have to maintain a very vast set of tools, frameworks, systems that support all the business functions of the company. We've got roughly over 1,000 unique apps from web or native apps. We've got tens of thousands of front-ends, and we do tens of thousands of production deployments every week. So, there's quite a lot of throughput in general and a lot of strain on anything to do with infrastructure. And our job, really, is to unify the DX of practically everything into central solutions that can work for various functions of the business. So, that's a bit of context for what we do.

So, one of the things is there are a lot of complexities in underlying build tools and in the kind of stacks that we have to work with. So, kind of what we had discovered along the way is operations, specifically between, say, open-source versus internal operations, do have some key differences. The main ones that we have kind of seen is usually, I would say, just the complexity of the business that we have to support is usually larger than what you would see in your typical kind of open-source projects. The scope of responsibility, as well, is also quite different. From what we often see in like an open-source project is usually you would have a kind of single point of focus. So, if we think of like Next.js, it's primarily for web, SSR, or React Native, which obviously focuses on kind of like native apps. But we need to support a really vast ecosystem that can power various functions of the business and looking for tools that really do that well as a whole. I would say probably the biggest difference, though, that we've seen is the on-call obligations. Typically, in open-source, there is no on-call obligation. You open a git issue, and it might get responded to, so on and so forth. But for us on the Inver team, considering we support, I think, 150,000 employees currently, we have a really high expectation on getting these on-calls closed, whereas, you know, most of them are solved within 24 hours, and almost anything, anywhere, is solved within one week. So, that's quite a high demand and pressure.

So, kind of why did we end up looking at writing a custom bundler? So, one, things were getting complicated. Lots of these various tools, ecosystems, products, designed to support very different functions of the business, from native to embedded systems to custom hardware development, web, hybrid web, so on and so forth, it continues to grow. Finding a suitable solution was quite tricky, especially if we're looking at things that work really, really well with native, that are quick and fast, but also, perhaps, work in very exotic environments. I don't know if anybody has ever worked with a WeChat app or something like that, but they are non-JavaScript-based, so you're kind of writing JSON modules, and you would need a compiler that can emit, essentially, JSONs instead of emitting JavaScript. So, really exotic environments we also had to try and work within. So, obviously, what we're looking for is something that's gonna support the business really well, something that's stable, something that's gonna be efficient, something that can scale, especially as the number of products under the portfolio continue to grow. And a big challenge we had seen is a lot of our on-call obligations usually went to debugging problems in the build, so trying to reduce that on-call pressure was very critical for us. So, how did RSPack actually get started? It was actually started with something we call Link Speedy, which is essentially our in-house cross-platform development solution. I think we're open-sourcing it in 2025, early 2025. We're planning to open-source it. But the origins of RSPack really started here with Links. Initially, what it was is actually, it was just called Speedy, and it was basically an ES Build plugin, and that was it.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

The Core of Turbopack Explained (Live Coding)
JSNation 2023JSNation 2023
29 min
The Core of Turbopack Explained (Live Coding)
Tobias Koppers introduces TurboPack and TurboEngine, addressing the limitations of Webpack. He demonstrates live coding to showcase the optimization of cache validation and build efficiency. The talk covers adding logging and memorization, optimizing execution and tracking dependencies, implementing invalidation and watcher, and storing and deleting invalidators. It also discusses incremental compilation, integration with other monorepo tools, error display, and the possibility of a plugin system for Toolpag. Lastly, the comparison with Bunn's Builder is mentioned.
Rome, a Modern Toolchain!
JSNation 2023JSNation 2023
31 min
Rome, a Modern Toolchain!
Top Content
Rome is a toolchain built in Rust that aims to replace multiple tools and provide high-quality diagnostics for code maintenance. It simplifies tool interactions by performing all operations once, generating a shared structure for all tools. Rome offers a customizable format experience with a stable formatter and a linter with over 150 rules. It integrates with VCS and VLSP, supports error-resilient parsing, and has exciting plans for the future, including the ability to create JavaScript plugins. Rome aims to be a top-notch toolchain and welcomes community input to improve its work.
Server Components with Bun
Node Congress 2023Node Congress 2023
7 min
Server Components with Bun
Top Content
Bun is a modern JavaScript runtime environment that combines a bundler, transpiler, package manager, and runtime. It offers faster installation of NPM packages and execution of package.json scripts. Bun introduces a new JavaScript and TypeScript bundler with built-in support for server components, enabling easy RPC with the client. This allows for code splitting and running code that streamingly renders React or any other library from the server and mixes it with client code, resulting in less JavaScript sent to the client.
Challenges for Incremental Production Optimizations
JSNation 2024JSNation 2024
32 min
Challenges for Incremental Production Optimizations
TurboPack is a new bundle similar to Webpack, focusing on incremental builds to make them as fast as possible. Challenges in production builds include persistent caching, incremental algorithms, and optimizing export usage. The compilation process can be split into parsing and transforming modules, and chunking the module graph. TurboPack aims to achieve faster production builds through incremental optimization and efficiency. Collaboration and compatibility with other ecosystems are being considered, along with the design of a plugin interface and tree-shaking optimization.
Parcel 2: the Automagical Bundler
DevOps.js Conf 2021DevOps.js Conf 2021
8 min
Parcel 2: the Automagical Bundler
Parcel 2 is a ground-up rewrite of Parcel 1, a fast and scalable zero-configuration web application bundler used by large companies like Atlassian and Adobe. It offers a zero-config approach with good defaults, making it production-ready out of the box. The new features include a revamped plugin system, a configuration file, transformers for file conversion, optimizers for code compression, target support for different browsers, diagnostics for error debugging, and named pipelines for data and JavaScript in different formats. Parcel 2 also supports different import scenarios, such as importing JSON files with named pipelines and using query parameters for image optimization. It includes various performance improvements, stable caches, optimized data structures, enhanced code splitting and bundling, improved scope hosting, and better support for monorepos and libraries. A React example is provided to showcase the simplicity of Parcel and how to use it with React.
Owning your Build-step – Owning your Code
DevOps.js Conf 2021DevOps.js Conf 2021
28 min
Owning your Build-step – Owning your Code
This Talk explores JavaScript code optimization using Rollup, showcasing examples of improved load times and reduced server size. It delves into Rollup customization and plugin development, demonstrating how to write plugins and remove code using hooks. The Talk also covers module code loading, advanced code control, and importing/emitting files with Rollup. Additionally, it highlights the adoption of Rollup's plugin system by other tools and introduces a self-made terminal used in the presentation.