S

scriptc

SHA-256
6.2k stars·Developer Tools·SHA-256 checksum verified

Compiles TypeScript and JavaScript to native executables and WebAssembly; the output runs without Node.js installed.

Smart Download

Download Download Version

v0.3.6 · 77.6 MB

Compiles TypeScript into true native executables that run without Node.js.

Core Features

  • Compiles TypeScript/JavaScript to true native executables via ahead-of-time compilation
  • Outputs WebAssembly (WASI) modules
  • Binaries run without Node.js installed
  • npm dependencies compile in with your code, no node_modules at runtime
  • scriptc coverage command reports what compiles, with diagnostics and rewrite hints

What It Can't Do

  • •Caveats: this is an experimental project supporting only a subset of JavaScript, TypeScript, and Node.js APIs—dynamic features like eval will not compile. Not all npm packages are supported; run scriptc coverage before committing to a dependency. Building executables requires a linker and the platform SDK or sysroot, and on Windows you must build hello.exe and run it as .\hello.exe. Running WASI modules with scriptc run still requires Node.js. Avoid relying on it for critical production workloads, as behavior may change between releases.

Use Cases

  • Distribute CLI tools as single binaries to users without Node.js
  • Build lightweight native HTTP servers for servers or minimal containers
  • Embed WASI modules into external build systems
  • Cross-compile executables for macOS, Linux, and Windows from one machine

Detailed Introduction

scriptc is an experimental compiler from Vercel Labs that turns TypeScript and JavaScript into native executables and WebAssembly modules. Instead of bundling a JavaScript runtime, it uses the type information checked by the TypeScript compiler to generate real machine code, so the output runs without Node.js installed. npm packages your program imports are compiled in alongside your code, eliminating node_modules at runtime. Compared with Bun's bun build --compile or Deno compile, which embed a full runtime into the binary, scriptc performs true ahead-of-time compilation, producing leaner, genuinely native artifacts and WASI modules. A built-in scriptc coverage command reports how much of an existing program compiles, with diagnostics and rewrite hints for unsupported code. The compiler runs natively on macOS, Linux, and Windows, supports cross-compilation, a subset of Node.js APIs such as node:http, and native FFI for calling C ABI functions. Note that it is experimental: only a subset of JavaScript, TypeScript, and Node.js APIs is supported, and building executables requires a linker and platform SDK.

Troubleshooting & FAQ (2)

Troubleshooting
Why does a generic class method throw 'TypeError: x is not a function' in the compiled binary but work fine in Node?

Known compiler bug (v0.3.0, issue #963). A computed-key write anywhere on a generic class instance, e.g. (obj as any)[key] = fn with a non-literal key, makes the method-name census demote that class's methods into prototypeMethodAccesses. The lowered code then reads the per-instance dynamic property bag with no dyn.hasKey guard, and classPrototypeData returns null for generic/generic-instance classes, so there is no prototype fallback: the bag read yields undefined and the call throws. Non-generic classes are unaffected because they get a prototype-data helper.

Workarounds until the compiler fix lands:
1. Eliminate dynamic-key writes on generic class instances — store external metadata in a separate Map/side table or use literal property assignments instead of obj[expr] = value.
2. If feasible, drop the type parameter (use a concrete type instead of Ctx<T>) so the class compiles through the non-generic path, which builds the prototype-data helper and resolves methods correctly.

Compiler-side fix directions under discussion: emit prototype data for generic instances so the bag read has a fallback, or retain the dyn.hasKey guard for methods of generic classes so reads fall back to the static method.

GitHub Issue #963
Troubleshooting
How to fix SC1090 error when calling a generic method through an interface-typed receiver in scriptc?

SC1090 means the compiler cannot statically prove the receiver's runtime class, which is required because generic methods dispatch statically. This happens when an object passes through any and is cast back to an interface (e.g., const restored = erased as GenericIdentity; restored.id(42)). This pattern is not supported yet (feature request #905). Workarounds: (1) Call the generic method directly on the original typed object before it is erased to any — direct calls through the original object are supported. (2) For class instances, bind the receiver to a const initialized with its new expression so the class is provable: const r: GenericIdentity = new C(...). Note: there is currently no workaround for generic arrow-function properties on object literals that must round-trip through any or type-erased storage.

GitHub Issue #905

Tags

typescriptcompilernativewebassemblyjavascriptaot

Getting Started

1

Download installer

Click the button above to download the installer for your system

2

Install the software

Double-click the downloaded installer and follow the prompts

3

Install Node.js 24 or later together with npm

4

Run npm install -g scriptc to install the compiler globally

5

Create a TypeScript file such as hello.ts

Install Guide
  1. Install Node.js 24 or later together with npm
  2. Run npm install -g scriptc to install the compiler globally
  3. Create a TypeScript file such as hello.ts
File Integrity

SHA-256 checksum verified

Checksum extracted from GitHub official Release page

SHA256 Checksum

e18724e690ed6f64f3de56eb990b5c5a4617638bef683356342f4e1894382741

This checksum is extracted from the GitHub Release page. Verify file integrity after download.

All SHA-256 checksums on this platform are extracted from the project's official GitHub Release page, without any modification. You can independently verify them on the GitHub Releases page.

Open Source Transparency

View GitHub Source
Environment Guide

Uninstall Info

Run npm uninstall -g scriptc to remove the compiler. If you installed a standalone archive from GitHub Releases, simply delete the extracted files. Executables you already built keep working independently and can be kept or deleted separately.

No Extra Dependencies

Ready to use after download. No additional runtime required.

Project Info
LicenseApache-2.0
Last Updated2026-10-21 00:36:34
GitHub RepositoryOfficial Website

Having issues? Check the FAQ below

2 FAQs

Similar Projects