Skip to content

Change build from Webpack to Rspack#2017

Draft
labkey-alan wants to merge 1 commit into
developfrom
fb_rspack_build
Draft

Change build from Webpack to Rspack#2017
labkey-alan wants to merge 1 commit into
developfrom
fb_rspack_build

Conversation

@labkey-alan

@labkey-alan labkey-alan commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Rationale

This PR changes our build from Webpack to Rspack. I was looking into improving the error overlay in our hot reload build, but the webpack dev server is essentially incapable of rendering file names and line numbers in the overlay at this time. Rspack's dev server supports this feature. Rspack is also significantly faster at the transpilation and bundling aspects of our build (see non-scientific benchmarks below).

Note: this branch is mostly an experiment, I am not 100% convinced that this PR should be merged. It definitely warrants a discussion before we consider merging. If we do decide to merge this I'll make sure all of our client builds are updated to use rspack as part of the merge. The following builds have been updated to use the new Rspack build:

  • Our packages: @labkey/components, @labkey/premium
  • Our builds in platform: core, assay, experiment, pipeline
  • Our builds in limsModules: biologics, inventory, sampleManagement

Benchmarked Run Times

If you run the Rspack build you may be surprised that the build time doesn't seem significantly faster, despite Rspack, and the underlying compiler, SWC, claiming a 20x to 70x perf boost. This is because our bottleneck is not, and never has been, Babel (our previous transpiler/bundler). Below are build times for our @labkey/components package without TypeScript. I ran each build five times in a row.

  • webpack: 2310 ms, 2234 ms, 2317 ms, 2085 ms, 2115 ms
  • rspack: 415 ms, 139 ms, 148 ms, 244 ms, 145 ms

As you can see, our transpile/bundle times have improved by an order of magnitude.

Future Improvements

One way to further increase our build perf would be to update our build to TypeScript 7.0, which would potentially give us a 10x perf boost in our build. TS is not currently out, but is currently in beta. In order to adopt TS7 we'd need to update our build configurations, as there are several backwards incompatible changes they have made, @labkey-nicka has a branch that upgrades our build to use TypeScript 6, which would also make our build compatible with TypeScript 7.

We could merge this branch today, gaining the perf boost to our transpilation pipeline, but I think we could also consider leaving this branch open until TS7 is out, and update to TS7 and Rspack at the same time. According to the beta announcement blog post linked above they anticipate releasing TS7 "within the next two months", which means it should be out in a few days or weeks from now. We could also update our build to use the TS7 beta branch, as it does look like we'd be able to use it without issues.

Related Pull Requests

Changes

  • Change build package to use Rspack instead of Webpack
  • Update components to use Rspack build

@labkey-alan labkey-alan requested a review from labkey-nicka June 11, 2026 06:44
@labkey-alan labkey-alan self-assigned this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant