Review main Abandoned

92342[WIP][TASK] Use esbuild for TypeScript compilation

Benni Mack CR 0 V -1 Expert +572 −436 updated 01/15/26, 17:02

Commit message

This change replaces the "tsc"-based TypeScript compilation with
esbuild for significantly faster build times. The new standalone
build script compiles 435 TypeScript files in ca. 3.5 seconds
compared to 10+ seconds with tsc.

TypeScript is now compiled via a standalone npm script in
"Build/Scripts/build-typescript.mjs".

Type-checking (tsc --noEmit) and linting (eslint) are now separate
commands that can be run independently:
- npm run typecheck
- npm run lint:js

The related scripts are now:
- npm run build-js (was previously a wrapper for "grunt scripts")
- npm run build-js:sourcemaps
- npm run lint:js
- npm run typecheck

The build pipeline now works as follows:
1. esbuild compiles TypeScript to JavaScript directly (no tsc)
2. Rollup post-processes the output (import mapping, Lit template minification, esbuild minification, license banner)

All resulting JS files are now different because:
- tsc emits a __decorate helper that checks for Reflect.decorate (esbuild uses a simpler helper without the Reflect check)
- tsc uses static calls - esbuild uses "t.styles=w.getStyles()" instead of "static{this.styles=S.getStyles()}"
- tsc and esbuild use different variable names in minification

Review

  • Code review CR 0
  • Verified V -1
    • core-ci -1 CI

Files 274

Show 254 more files

Review log 56

  1. Benni Mack uploaded patch set 1 01/15/26, 12:38

  2. core-ci voted on patch set 1 V -1 01/15/26, 12:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93516

  3. Benjamin Franzke commented on patch set 1 01/15/26, 13:57

    I don't like this comparison since a standalone build *always* requires to perform type checking, otherwise the emitted output is useless (could be wrong if not typechecked). Given that tsc is rewriten for speed in Go (TypeScript 7) anyway I think we should stick with `tsc` and not switch to esbuild for this buildstep.
  4. Benni Mack commented on patch set 1 01/15/26, 14:36

    Reply

    well, if we have a solution with tsc, that's great. hopefully this will happen at some point (https://devblogs.microsoft.com/typescript/progress-on-typescript-7-december-2025/ reads fine, but without a further plan on the releases really). But yeah, fine with that.
  5. Benni Mack abandoned the change 01/15/26, 16:06

    won't do.
  6. Benjamin Franzke commented on patch set 1 01/15/26, 17:02

    Reply

    Btw, I'm wondering why `tsc` is so slow for you, it is 4 seconds for me after clearing the cache. With cache (like when using `npm run build -- watch` only some milliseconds) Anyway, current `tsc` requires 4 seconds while eslint requires 7 seconds (I've configured both to run in parallel when `npm run build` or `npm run build-js` is invoked, but our bottleneck actually is `eslint` not `tsc`).