• Stars
    star
    701
  • Rank 62,128 (Top 2 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 14 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild

Esbuild Runner (esr)

Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild.

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.

Usage

The easiest way to use esbuild-runner is to install it globally and use the included esr binary.

$ esr hello-world.ts

Alternatively, you can require esbuild-runner within any nodejs process to include realtime transpilation:

$ node -r esbuild-runner/register hello-world.ts

In order to use esbuild-runner with Jest, you need to configure a Jest transform in your jest.config.js

module.exports = {
  transform: {
    "\\.ts$": "esbuild-runner/jest",
  },
}

VSCode Debugging

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug with esbuild-runner",
      "program": "${workspaceFolder}/hello-world.ts",
      "runtimeArgs": [
        "-r",
        "esbuild-runner/register"
      ],
      "request": "launch",
      "sourceMaps": true,
      "skipFiles": [
        "<node_internals>/**"
      ],
      "type": "pwa-node"
    }
  ]
}

⚙️ Configuration

esr provides two different ways to transpile your code:

  • 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.
  • 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.
$ bin/esr.js --help
Usage: esr [options] <source-file> [file-options]

  --cache       Transform on a file per file basis and cache code
  --clearCache  Clear transform cache
  --help|-h     Display this help message

To 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.

// example esbuild-runner.config.js
module.exports = {
  type: "bundle", // bundle or transform (see description above)
  esbuild: {
    // Any esbuild build or transform options go here
    target: "esnext",
  },
}

📦 Installation

Simply install the esbuild-runner npm package using your favorite package manager.

  • globally ...
$ npm install -g esbuild-runner
  • ... or locally in your project
$ npm add --dev esbuild-runner

👋 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

⚖ License

Apache 2.0

More Repositories

1

lazy.nvim

💤 A modern plugin manager for Neovim
Lua
11,573
star
2

tokyonight.nvim

🏙 A clean, dark Neovim theme written in Lua, with support for lsp, treesitter and lots of plugins. Includes additional themes for Kitty, Alacritty, iTerm and Fish.
Lua
5,173
star
3

trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Lua
4,726
star
4

which-key.nvim

💥 Create key bindings that stick. WhichKey is a lua plugin for Neovim 0.5 that displays a popup with possible keybindings of the command you started typing.
Lua
4,441
star
5

noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Lua
3,677
star
6

todo-comments.nvim

✅ Highlight, list and search todo comments in your projects
Lua
2,711
star
7

flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Lua
1,965
star
8

neodev.nvim

💻 Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.
Lua
1,935
star
9

zen-mode.nvim

🧘 Distraction-free coding for Neovim
Lua
1,442
star
10

ultra-runner

🏃⛰ Ultra fast monorepo script runner and build tool
TypeScript
1,188
star
11

twilight.nvim

🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
Lua
1,130
star
12

dot

☕️ My Dot Files
Lua
670
star
13

edgy.nvim

Easily create and manage predefined window layouts, bringing a new edge to your workflow
Lua
665
star
14

neoconf.nvim

💼 Neovim plugin to manage global and project-local settings
Lua
605
star
15

persistence.nvim

💾 Simple session management for Neovim
Lua
533
star
16

lsp-colors.nvim

🌈 Plugin that creates missing LSP diagnostics highlight groups for color schemes that don't yet support the Neovim 0.5 builtin LSP client.
Lua
434
star
17

devmoji

🤖 🚀 ✨ Emojify your conventional commits with Devmoji
TypeScript
286
star
18

styler.nvim

Simple Neovim plugin to set a different colorscheme per filetype.
Lua
247
star
19

drop.nvim

🍁 Fun little plugin that can be used as a screensaver and on your dashboard
Lua
190
star
20

polydock

✨ A shiny and hackable application dock
TypeScript
179
star
21

paint.nvim

Easily add additional highlights to your buffers
Lua
152
star
22

vscode-monorepo-workspace

📦✨Manage monorepos with multi-root workspaces. Supports Lerna, Yarn, Pnpm, Rushjs and recursive package directories.
TypeScript
138
star
23

splashcii

Simple cli tool that shows a random ascii art from https://www.asciiur.com/
TypeScript
35
star
24

semantic-release-commit-filter

📦🕵️‍♀️ Semantic-release plugin that filters git commits based on the current working directory
JavaScript
25
star
25

zmk-config

Folke's ZMK config
C++
21
star
26

lovelace-styler

Custom styling for lovelace cards
TypeScript
18
star
27

folke

7
star
28

phpintel

Accurate autocompletion / code checking / .... framework for PHP
PHP
3
star
29

adventofcode

🎅 🎄 ⛄ ✨ Solutions for Advent of Code 2020 in TypeScript
TypeScript
2
star
30

chess

C#
2
star
31

adventofcode2019

Advent of Code 2019 in TypeScript
TypeScript
2
star