https://github.com/egoist/esbuild-register
Transpile JSX, TypeScript and esnext features on the fly with esbuild
https://github.com/egoist/esbuild-register
Last synced: 10 months ago
JSON representation
Transpile JSX, TypeScript and esnext features on the fly with esbuild
- Host: GitHub
- URL: https://github.com/egoist/esbuild-register
- Owner: egoist
- License: mit
- Created: 2020-07-16T04:07:45.000Z (over 5 years ago)
- Default Branch: dev
- Last Pushed: 2024-07-25T13:46:42.000Z (over 1 year ago)
- Last Synced: 2025-05-16T05:02:04.312Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 168 KB
- Stars: 1,011
- Watchers: 5
- Forks: 53
- Open Issues: 46
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - esbuild-register
- awesome - egoist/esbuild-register - Transpile JSX, TypeScript and esnext features on the fly with esbuild (TypeScript)
README
# esbuild-register
[](https://npm.im/esbuild-register) [](https://npm.im/esbuild-register)
## Install
```bash
npm i esbuild esbuild-register -D
# Or Yarn
yarn add esbuild esbuild-register --dev
# Or pnpm
pnpm add esbuild esbuild-register -D
```
## Usage
```bash
node -r esbuild-register file.ts
```
It will use `jsxFactory`, `jsxFragmentFactory` and `target` options from your `tsconfig.json`
### Experimental loader support
When using in a project with `type: "module"` in `package.json`, you need the `--loader` flag to load TypeScript files:
```bash
node --loader esbuild-register/loader -r esbuild-register ./file.ts
```
## Programmatic Usage
```ts
const { register } = require('esbuild-register/dist/node')
const { unregister } = register({
// ...options
})
// Unregister the require hook if you don't need it anymore
unregister()
```
## Sponsors
[](https://github.com/sponsors/egoist)
## License
MIT © [EGOIST](https://egoist.dev)