|
|
3 年之前 | |
|---|---|---|
| .. | ||
| bin | 3 年之前 | |
| dist | 3 年之前 | |
| lib | 3 年之前 | |
| LICENSE | 3 年之前 | |
| README.md | 3 年之前 | |
| package.json | 3 年之前 | |
| register.js | 3 年之前 | |
Runtime typescript and ESM support for Node.js (CommonJS)
requireconst jiti = require('jiti')(__filename)
jiti('./path/to/file.ts')
You can also pass options as second argument:
const jiti = require('jiti')(__filename, { debug: true })
jiti index.ts
# or npx jiti index.ts
node -r jiti/register index.ts
Alternatively, you can register jiti as a require hook programmatically:
const jiti = require('jiti')()
const unregister = jiti.register()
debugfalseJITI_DEBUGEnable debug to see which files are transpiled
cachetrueJITI_CACHEUse transpile cache
If set to true will use node_modules/.cache/jiti (if exists) or {TMP_DIR}/node-jiti
esmResolvefalseJITI_ESM_RESOLVEUsing esm resolution algorithm to support import condition.
transformTransform function. See src/babel for more details
sourceMapsfalseJITI_SOURCE_MAPSAdd inline source map to transformed source for better debugging.
yarnyarn buildyarn devyarn jiti ./test/path/to/file.tsMIT. Made with 💖