scriptc TypeScript compiler: native builds
scriptc is a practical choice for small TypeScript-to-native experiments, especially when the finished program should run without Node.js. It is not yet a general production answer: JavaScript, Node.js API, and npm coverage remain partial, and native builds need a linker plus the right platform SDK or sysroot.
What scriptc compiles
scriptc is an experimental TypeScript-to-native compiler that turns TypeScript and JavaScript into native executables or WebAssembly. It uses checks from the TypeScript compiler to generate machine code, bundles supported npm imports, and reports code it cannot compile with a diagnostic and, where available, a rewrite hint.
Native builds and compatibility tools
- βscriptc produces native executables and WebAssembly from TypeScript and JavaScript sources.
- βThe compiler uses TypeScript-checked type information to generate machine code.
- βAt build time, unsupported code produces a diagnostic and, if one is available, a rewrite hint.
- β`scriptc coverage` measures how much of an existing program can compile before a full build.
- βSupported npm dependencies are bundled into the compiled program instead of being loaded from `node_modules` at runtime.
- βSelected Node.js APIs compile against scriptc's native runtime, including examples based on `node:http`.
Servers, command-line tools, and WASM
- β’scriptc suits small command-line utilities that should launch as standalone native executables.
- β’Internal HTTP servers can use scriptc when their imported Node.js APIs fall within the supported set.
- β’scriptc can build TypeScript-to-WebAssembly projects, including WASI modules.
- β’Teams can use scriptc coverage to assess whether a controlled internal program fits the supported subset before deployment.
- β’Cross-compilation is possible for targets described by scriptc's platform documentation, subject to native linking requirements.
Installing the native compiler
Install the scriptc CLI globally with Node.js 24 or later: `npm install -g scriptc` The compiler itself runs natively on macOS, Linux, and Windows. Node.js is required only for installation and for running WASI modules with `scriptc run`. Standalone compiler archives are available through GitHub Releases. Building executables also requires a linker and the platform SDK or sysroot. A complete build-from-source procedure is not clearly documented in the README; it points contributors to `CONTRIBUTING.md`.
Building and running a program
Run a TypeScript file directly with `scriptc run hello.ts`. Build a native executable with `scriptc build hello.ts -o hello`, then execute `./hello`; on Windows, use `hello.exe` and `.\hello.exe`. Check compatibility before building with `scriptc coverage hello.ts`. For a project importing npm packages, install the dependency first, then run `scriptc build cli.ts -o cli`. The resulting program does not read `node_modules` at runtime.
Strengths
- βscriptc turns TypeScript and JavaScript into native executables and WebAssembly, so the resulting program can run without Node.js installed.
- βThe compiler uses TypeScriptβs type checking to generate machine code and reports unsupported code at build time, with rewrite hints where available.
- βImported npm packages are compiled into the executable, avoiding runtime reads from node_modules.
- β`scriptc coverage` lets teams check how much of an existing program compiles before committing to a full build.
- βSupported Node.js APIs, including `node:http`, compile to the native runtime, allowing server programs to be packaged as executables.
Experimental and partial compatibility
- β³scriptc is experimental and supports only a subset of JavaScript, TypeScript, and Node.js APIs.
- β³npm package support is partial, so an import can become a compatibility boundary even when the surrounding application compiles.
- β³Native executable builds require a linker and the platform SDK or sysroot; the README does not provide a complete cross-compilation matrix.
- β³Node.js remains necessary for running WASI modules with `scriptc run`, despite not being required by native executable output.
- β³The README does not clearly document a complete build-from-source installation procedure, although it links to `CONTRIBUTING.md`.
scriptc versus standard TypeScript output
Frequently asked questions
scriptc is an experimental compiler for TypeScript, JavaScript, and WebAssembly. It can generate native executables, compile supported Node.js APIs, and bundle supported npm dependencies into the output while leaving Node.js out of the native runtime.
scriptc is not production-ready. Its own documentation describes the compiler as experimental, supports only some JavaScript, TypeScript, and Node.js APIs, and notes partial npm package compatibility. Coverage reports should be treated as a pre-deployment compatibility check.
A scriptc native executable does not require Node.js at runtime. Node.js is needed to install scriptc and to run WASI modules with `scriptc run`; supported npm dependencies are compiled into the native program rather than loaded from `node_modules`.
The installed scriptc compiler runs on macOS, Linux, and Windows. Native executable builds also need a linker and the appropriate platform SDK or sysroot. The README refers readers to the platform documentation for exact cross-compilation and WebAssembly requirements.
scriptc can compile supported npm packages and selected Node.js APIs, including an HTTP server example based on `node:http`. Support is partial, so developers should test imports and APIs with `scriptc coverage` and consult the compatibility references.
Yes. scriptc is distributed under the Apache-2.0 license, which permits commercial use subject to the license's terms. The license governs use of the compiler and its source code.
Who should try it β and who should skip
Try scriptc if you own a small TypeScript CLI, internal server, or WASI experiment and need the final program to run without Node.js. Run `scriptc coverage` first, then verify every imported package and Node.js API against the compatibility references. Skip it for a large application built around unsupported APIs, an uncontrolled npm dependency tree, or a platform where you cannot provide the required linker and SDK. scriptc is not production-ready for teams that need predictable compatibility across an entire Node.js ecosystem.
Is scriptc worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of scriptc.
