{"id":14981533,"url":"https://github.com/figma/esbuild-runner","last_synced_at":"2025-10-02T22:31:44.276Z","repository":{"id":50890421,"uuid":"460127177","full_name":"figma/esbuild-runner","owner":"figma","description":"⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild","archived":false,"fork":true,"pushed_at":"2023-03-01T10:52:36.000Z","size":209,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"figma","last_synced_at":"2024-09-29T05:41:42.227Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/esbuild-runner","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"folke/esbuild-runner","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/figma.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-16T18:25:03.000Z","updated_at":"2023-05-01T03:48:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/figma/esbuild-runner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figma%2Fesbuild-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figma%2Fesbuild-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figma%2Fesbuild-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figma%2Fesbuild-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/figma","download_url":"https://codeload.github.com/figma/esbuild-runner/tar.gz/refs/heads/figma","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235049009,"owners_count":18927715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:03:46.594Z","updated_at":"2025-10-02T22:31:38.982Z","avatar_url":"https://github.com/figma.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Esbuild Runner (`esr`)\n\nSuper-fast on-the-fly transpilation of modern JS, TypeScript and JSX using [esbuild](https://github.com/evanw/esbuild).\n\n**esr** makes it easy to run arbitrary code or tests without needing to **build** your whole project. It's a great way to improve your development workflow.\n\n## ✨ Usage\n\nThe easiest way to use **esbuild-runner** is to install it globally and use the included `esr` binary.\n\n```shell\n$ esr hello-world.ts\n```\n\nAlternatively, you can _require_ **esbuild-runner** within any nodejs process to include realtime transpilation:\n\n```shell\n$ node -r esbuild-runner/register hello-world.ts\n```\n\nIn order to use **esbuild-runner** with Jest, you need to configure a [Jest transform](https://jestjs.io/docs/en/configuration.html#transform-objectstring-pathtotransformer--pathtotransformer-object) in your `jest.config.js`\n\n```js\nmodule.exports = {\n  transform: {\n    \"\\\\.ts$\": \"esbuild-runner/jest\",\n  },\n}\n```\n\nVSCode Debugging\n\n```JSON\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug with esbuild-runner\",\n      \"program\": \"${workspaceFolder}/hello-world.ts\",\n      \"runtimeArgs\": [\n        \"-r\",\n        \"esbuild-runner/register\"\n      ],\n      \"request\": \"launch\",\n      \"sourceMaps\": true,\n      \"skipFiles\": [\n        \"\u003cnode_internals\u003e/**\"\n      ],\n      \"type\": \"pwa-node\"\n    }\n  ]\n}\n```\n\n## ⚙️ Configuration\n\n`esr` provides two different ways to transpile your code:\n\n- **bundling** _(default)_: this transpiles the script and all its dependencies in typically one invocation of **esbuild**. Dependencies defined in `package.json` or `node_modules` will never be transpiled. Running `esr` will **always** transpile the code. No caching is used.\n- **transform** _(`--cache`)_: this method will invoke **esbuild** for **every source file**, but will cache the result. This means that the initial run will be slower, but after that, only changed source files will be transpiled.\n\n```shell\n$ bin/esr.js --help\nUsage: esr [options] \u003csource-file\u003e [file-options]\n\n  --cache       Transform on a file per file basis and cache code\n  --clearCache  Clear transform cache\n  --help|-h     Display this help message\n\n```\n\nTo customize the options passed to esbuild, you can create an `esbuild-runner.config.js` file in the current directory or one of the ancestor directories.\n\n```js\n// example esbuild-runner.config.js\nmodule.exports = {\n  type: \"bundle\", // bundle or transform (see description above)\n  esbuild: {\n    // Any esbuild build or transform options go here\n    target: \"esnext\",\n  },\n}\n```\n\n## 📦 Installation\n\nSimply install the **esbuild-runner** npm package using your favorite package manager.\n\n- globally ...\n\n```shell\n$ npm install -g esbuild-runner\n```\n\n- ... or locally in your project\n\n```shell\n$ npm add --dev esbuild-runner\n```\n\n## 👋 Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## ⚖ License\n\n[Apache 2.0](https://github.com/folke/esbuild-runner/blob/main/LICENSE)\n\n\u003c!-- markdownlint-disable-file MD014 MD033 --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigma%2Fesbuild-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffigma%2Fesbuild-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigma%2Fesbuild-runner/lists"}