|
|
il y a 2 ans | |
|---|---|---|
| .. | ||
| dist | il y a 2 ans | |
| node_modules | il y a 2 ans | |
| LICENSE | il y a 2 ans | |
| README.md | il y a 2 ans | |
| loader.js | il y a 2 ans | |
| package.json | il y a 2 ans | |
| register.js | il y a 2 ans | |
npm i esbuild esbuild-register -D
# Or Yarn
yarn add esbuild esbuild-register --dev
# Or pnpm
pnpm add esbuild esbuild-register -D
node -r esbuild-register file.ts
It will use jsxFactory, jsxFragmentFactory and target options from your tsconfig.json
When using in a project with type: "module" in package.json, you need the --loader flag to load TypeScript files:
node --loader esbuild-register/loader -r esbuild-register ./file.ts
const { register } = require('esbuild-register/dist/node')
const { unregister } = register({
// ...options
})
// Unregister the require hook if you don't need it anymore
unregister()
MIT © EGOIST