A tool to load and execute any JavaScript or TypeScript code at runtime.
npm install unrun[![Open on npmx][npmx-version-src]][npmx-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Unit Test][unit-test-src]][unit-test-href]
unrun is a tool that enables running and loading any module at runtime (TypeScript, ESM, CJS, JSX, etc.) by bundling it with Rolldown.
Check the documentation for more details.
``bash`
npm i unrun
`bash`
npx unrun ./path/to/file.ts
- Async
`ts
import { unrun } from 'unrun'
const { module } = await unrun({
path: './path/to/file.ts', // Path to the module to load
})
`
- Sync
`ts
import { unrunSync } from 'unrun'
const { module } = unrunSync({
path: './path/to/file.ts', // Path to the module to load
})
`
unrun` is highly inspired by tools like :
- jiti
- bundle-require
- tsx
[npmx-version-src]: https://npmx.dev/api/registry/badge/unrun
[npmx-version-href]: https://npmx.dev/unrun
[npm-downloads-src]: https://img.shields.io/npm/dm/unrun
[npm-downloads-href]: https://www.npmcharts.com/compare/unrun?interval=30
[unit-test-src]: https://github.com/gugustinette/unrun/actions/workflows/unit-test.yml/badge.svg
[unit-test-href]: https://github.com/gugustinette/unrun/actions/workflows/unit-test.yml