Home / Companies / Aspect Build / Blog / Post Details
Content Deep Dive

10-20x speedup for TypeScript transpilation in Bazel

Blog post from Aspect Build

Post Details
Company
Date Published
Author
Alex Eagle
Word Count
805
Language
English
Hacker News Points
-
Summary

In the development of TypeScript in Bazel, a new Bazel plugin named "ts_project" was created to replace the complex and less compatible "ts_library" rule, offering a simpler and more compatible solution. This new rule, developed with OJ Kwon, utilizes the standard TypeScript compiler (tsc) but initially suffered from slower compilation due to starting a new process for each task. Efforts to introduce a watch mode were unsuccessful in scaling effectively. However, the integration of the SWC transpiler, known for its speed and efficiency regardless of being a new process or in watch mode, has resolved these issues, providing up to a 20x increase in speed over previous methods. Users can now choose their preferred transpiler, such as SWC or Babel, while still relying on tsc for type-checking when necessary. This advancement, supported by EngFlow's sponsorship, is expected to eventually lead to the deprecation of the old ts_library rule, simplifying the TypeScript build process within Bazel.