{"id":40901,"library":"esbin","title":"esbin","description":"A fork of esbuild-register providing a hook for Node.js to transpile TypeScript, JSX, and modern JS on-the-fly using esbuild. Current version 0.0.4 requires esbuild >=0.19 <1. It aims to be a minimal drop-in replacement for ts-node with faster transpilation due to esbuild's speed. Unlike ts-node or sucrase, esbin is a thin wrapper around esbuild's transform API, offering no type checking. It is designed for development workflows where fast module loading is critical. The package is in early maintenance mode, with no breaking changes expected. Key differentiators: zero configuration, ESM and CJS support, and simple integration.","status":"active","version":"0.0.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/alex-kinokon/esbuild-register","tags":["javascript"],"install":[{"cmd":"npm install esbin","lang":"bash","label":"npm"},{"cmd":"yarn add esbin","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: uses esbuild's transform API for transpilation","package":"esbuild","optional":false}],"imports":[{"note":"esbin is not a default export; you must import the side-effect module 'esbin/register' to register the hooks.","wrong":"import esbin from 'esbin'","symbol":"default (import esbin)","correct":"import 'esbin/register'"},{"note":"register is a named export. The package is ESM-only; CommonJS require is not supported and will cause a SyntaxError.","wrong":"const { register } = require('esbin')","symbol":"register","correct":"import { register } from 'esbin'"},{"note":"To use the require hook, you must specify the full path 'esbin/register' or 'esbin/register' (with comma). Simply requiring 'esbin' does not register the hook.","wrong":"node -r esbin script.ts","symbol":"node -r esbin/register","correct":"node -r esbin/register script.ts"}],"quickstart":{"code":"import { register } from 'esbin';\nimport esbuild from 'esbuild';\n\nregister({\n  // optional: custom esbuild options\n  target: 'node18',\n  tsconfigRaw: '{}',\n});\n\n// now you can import TypeScript files\nimport './my-module.ts';\n\n// Or use the CLI node -r esbin/register\n// Then run: node -r esbin/register script.ts","lang":"typescript","description":"Demonstrates how to programmatically register esbin with custom esbuild options and import TypeScript files, or use the CLI require hook."},"warnings":[{"fix":"Run a separate type check (e.g., tsc --noEmit) or use ts-node with type checking if needed.","message":"esbin does **not** perform type checking; it only transpiles. Type errors will not be caught at runtime.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use import statements or use a dynamic import (e.g., await import('esbin/register')).","message":"Package is ESM-only. Using require('esbin') or require('esbin/register') will throw a SyntaxError.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Call register() at the very top of your entry point, or use the command line -r flag.","message":"The register function must be called before importing any TypeScript files. Calling it after imports may not work.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Consider using the original esbuild-register (though it's deprecated) or evaluate alternative solutions like tsx or ts-node.","message":"esbin is a fork of the deprecated esbuild-register package. The original may have breaking changes or lack of updates.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Use only one require hook or loader at a time. For REPL, load esbin/register via -r.","message":"When using Node.js's --experimental-loader, esbin may conflict with other loaders. Not all module systems (e.g., REPL) are supported.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.4':28 '0.19':31 '1':32 'aim':34 'api':70 'around':66 'break':96 'chang':97 'check':74 'cjs':105 'configur':102 'critic':86 'current':26 'design':77 'develop':79 'differenti':100 'drop':40 'drop-in':39 'due':50 'earli':91 'esbin':1,61 'esbuild':6,25,30,52,67 'esbuild-regist':5 'esm':103 'expect':98 'fast':82 'faster':48 'fli':23 'fork':3 'hook':10 'integr':109 'javascript':110 'js':19 'jsx':16 'key':99 'load':84 'mainten':92 'minim':38 'mode':93 'modern':18 'modul':83 'node':46,58 'node.js':12 'offer':71 'on-the-fli':20 'packag':88 'provid':8 'regist':7 'replac':42 'requir':29 'simpl':108 'speed':54 'sucras':60 'support':106 'thin':64 'transform':69 'transpil':14,49 'ts':45,57 'ts-node':44,56 'type':73 'typescript':15 'unlik':55 'use':24 'version':27 'workflow':80 'wrapper':65 'zero':101","created_at":"2026-06-04T18:49:49.067368+00:00","updated_at":"2026-06-04T18:49:49.067368+00:00","problems":[{"fix":"Change to import statement or use dynamic import: await import('esbin/register').","cause":"Using CommonJS require() to import an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use import { register } from 'esbin' instead of import register from 'esbin'.","cause":"Importing default export from 'esbin' when only named export 'register' exists.","error":"TypeError: esbin_register is not a function"},{"fix":"Use node -r esbin/register script.ts (note the trailing slash and register).","cause":"Running node -r esbin without the full path 'esbin/register'.","error":"Error: Cannot find module 'esbin/register'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/alex-kinokon/esbuild-register#readme","github":"ssh://git@github.com/alex-kinokon/esbuild-register","docs":null,"changelog":null,"pypi":null,"npm":"esbin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}