Skip to content

feat(compiler): add oxc builder#3446

Open
GNURub wants to merge 1 commit into
nestjs:masterfrom
GNURub:oxc-transform
Open

feat(compiler): add oxc builder#3446
GNURub wants to merge 1 commit into
nestjs:masterfrom
GNURub:oxc-transform

Conversation

@GNURub

@GNURub GNURub commented May 18, 2026

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Nest CLI currently supports tsc, swc, and webpack as builder options.

There is no OXC-based builder available, so users cannot compile projects through
oxc-transform using nest build or nest start.

Issue Number: N/A

What is the new behavior?

This PR adds an experimental oxc builder powered by oxc-transform.

The new builder supports:

  • nest build --builder oxc
  • nest start --builder oxc
  • Type checking through the existing TypeScript type checker flow
  • Watch mode
  • Source maps and inline source maps
  • Declaration files and declaration maps
  • .ts, .tsx, .mts, and .cts compilation
  • Proper output extensions for .mts -> .mjs and .cts -> .cjs
  • Cleanup of generated outputs when source files are deleted in watch mode

It also adds builder validation support for oxc in the build and start commands,
plus unit test coverage for the new compiler behavior and command integration.

The implementation uses oxc-transform@0.89.0 conservatively to avoid raising the
current Node.js engine requirement.

Does this PR introduce a breaking change?

  • Yes
  • No

This is additive. Existing builders and configuration continue to work as before.

Other information

Validation performed:

  • npm run build
  • npm test -- --runInBand --no-watchman
  • npx tsc --noEmit
  • git diff --check

@id6tm-mteterel

Copy link
Copy Markdown

Using the default NestJS template, I have the following error on build with oxc :

OXC Running...

 Error  
  x `await` is only allowed within async functions and at the top levels of
  | modules
   ,-[src/main.ts:8:1]
 7 | }
 8 | await bootstrap();
   : ^^^^^
   `----

The same code works with tsc, swc and rspack (on v12).

Compiling with oxc creates a runtime dependency on @oxc-project/runtime for the decorators support.

It would be a nice addition to have a log during watch mode reload, similar to how it was implemented on the rspack version in https://github.com/nestjs/nest-cli/blob/v12.0.0/lib/compiler/rspack-compiler.ts#L134

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.

2 participants