# import-without-cache

> Import ES modules without cache.

Latest version **0.4.1** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install import-without-cache
pnpm add import-without-cache
yarn add import-without-cache
bun add import-without-cache
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2026-09-16 |
| First published | 2025-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^22.18.0 \|\| >=24.0.0 |
| Dependencies | 0 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 11 |
| Author | Kevin Deng <sxzz@sxzz.moe> |
| Maintainers | sxzz |

## Links

- npm: https://www.npmjs.com/package/import-without-cache
- Repository: https://github.com/sxzz/import-without-cache
- Homepage: https://github.com/sxzz/import-without-cache#readme
- Issues: https://github.com/sxzz/import-without-cache/issues
- Funding: https://github.com/sponsors/sxzz
- npm.io page: https://npm.io/package/import-without-cache

## Recent versions

- 0.4.1 (latest) — 2026-09-16
- 0.4.0 — 2026-05-02
- 0.3.3 — 2026-04-16
- 0.3.2 — 2026-04-16
- 0.3.1 — 2026-04-16
- 0.3.0 — 2026-04-16
- 0.2.5 — 2025-12-21
- 0.2.4 — 2025-12-16
- 0.2.3 — 2025-12-10
- 0.2.2 — 2025-12-03
- 0.2.1 — 2025-12-02
- 0.2.0 — 2025-11-30
- 0.1.3 — 2025-11-30
- 0.1.2 — 2025-11-29
- 0.1.1 — 2025-11-29
- … 1 more at https://npm.io/package/import-without-cache/versions

## README

# import-without-cache

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Unit Test][unit-test-src]][unit-test-href]

Import ES modules without cache.

## Features

- Import ES modules without cache
- All dependencies are also imported without cache

## Install

```bash
npm i import-without-cache
```

## Usage

```ts
import { clearRequireCache, init, isSupported } from 'import-without-cache'

if (!isSupported) {
  throw new Error('import-without-cache is not supported in this environment.')
}

const deregister = init({
  // Optional
  skipNodeModules: false,
})

const mod = await import('some-module', { with: { cache: 'no' } })

clearRequireCache() // Optional: clear CommonJS cache if needed

// or
const mod2 = await import(`no-cache://some-module`)

expect(mod).not.toBe(mod2) // Different instances

deregister() // Optional: deregister the hooks when no longer needed
```

## Known Limitations

- Supports Node.js v22.18.0 and later; Deno is not supported.
- Yarn PnP is not supported on Node.js versions earlier than v24.
- In Bun, `clearRequireCache` works, but `init` is unnecessary because ESM imports behave the same as CommonJS requires.
- Only ESM modules are supported by default. The CommonJS cache can be cleared with `clearRequireCache`.
- `require(esm)` is supported starting in Node.js v24.13.1.

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
    <img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
  </a>
</p>

## License

[MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/import-without-cache.svg
[npm-version-href]: https://npmjs.com/package/import-without-cache
[npm-downloads-src]: https://img.shields.io/npm/dm/import-without-cache
[npm-downloads-href]: https://www.npmcharts.com/compare/import-without-cache?interval=30
[unit-test-src]: https://github.com/sxzz/import-without-cache/actions/workflows/unit-test.yml/badge.svg
[unit-test-href]: https://github.com/sxzz/import-without-cache/actions/workflows/unit-test.yml

---
_Source: https://npm.io/package/import-without-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
