Change build from Webpack to Rspack#2017
Draft
labkey-alan wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
@labkey/components,@labkey/premiumcore,assay,experiment,pipelinebiologics,inventory,sampleManagementBenchmarked 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/componentspackage without TypeScript. I ran each build five times in a row.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