JavaScript and TypeScript with Elide

Run JavaScript and TypeScript, install npm packages, test, and serve with Elide

Elide runs JavaScript and TypeScript directly, with CommonJS, ES modules, and a subset of the Node and Web APIs. TypeScript needs no compile step and no tsconfig.json.

elide run app.js
elide run app.ts
elide app.ts
elide run -s 'console.log(1 + 1)'

Extensions: .js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx. JSX and TSX are transformed, but Elide provides no UI framework or DOM; install what your code imports, such as React’s react/jsx-runtime.

npm packages

Declare dependencies in package.json. Plain elide install skips npm, so pass --ecosystems=npm:

{
  "type": "module",
  "dependencies": { "zod": "3.24.1" }
}
// app.ts
import { z } from "zod";

const User = z.object({ name: z.string() });
console.log(`Hello, ${User.parse({ name: "Ada" }).name}!`);
elide install --ecosystems=npm
elide run app.ts
elide install — package.json dependencies used from TypeScript

Packages are installed into node_modules. Use --ecosystems=maven,npm or --workspace when the project also has Maven dependencies. See NPM Installer for lockfiles and options.

Tests

elide test finds *.test.ts, *.spec.js, files under test/, and similar. Write them with node:test:

// math.test.ts
import test from "node:test";
import assert from "node:assert";

test("adds", () => {
  assert.equal(1 + 1, 2);
});
elide test

Servers

elide serve --no-tui ./dist # static files on 127.0.0.1:8080
elide dev --no-tui ./src    # live reload on port 3000

Given a script, serve and dev run it; a module that exports a fetch handler is served directly. See Development Server.

More

Implemented Node and Web modules are listed in the API Overview; measured results are in the Compatibility Matrix.