Import-fresh is a Node.js utility for importing an ES module while bypassing the import cache, so code can be reloaded with fresh state. It is useful for development and testing scenarios where you need a freshly imported module, with an optional option to avoid cache-busting modules inside node_modules.
Project status
- Actively maintained: Yes, recent updates are being published as of 2026-09-25, with a follow-up release only days after the prior update (v4.0.1 after v4.0.0).
- Apparent update cadence: Roughly semiannual for the last major change (v4.0.0 on 2026-02-25), plus a short-gap patch afterward (v4.0.1 on 2026-09-25). Earlier history shows long quiet periods, but the most recent stretch suggests renewed activity.
AI summary generated
Recent updates
v4.0.1
v4.0.1 adds validation to reject import attributes when the target module is CommonJS. The new behavior throws an error before the CommonJS module is executed, preventing any import-related side effects from running.
Breakingv4.0.0
v4.0.0 is a major release that converts import-fresh to pure ESM and requires Node.js 22.15+. The core behavior changes to an async, hook-based implementation that supports “fresh” importing of ESM modules.
BreakingFeaturesv3.3.1
v3.3.1 is a small maintenance release that claims to fix Bun compatibility. The code changes primarily adjust how module loading falls back when the parent module lacks a usable require function.
v3.3.0
v3.3.0 primarily updates the TypeScript type declarations for import-fresh. It also replaces the Travis CI configuration with a GitHub Actions workflow and includes a few metadata/docs formatting changes.
Featuresv3.2.2
v3.2.2 updates import-fresh to safely handle situations where there is no parent module. The change adjusts how the base directory (cwd) is determined when resolving the target module, and adds a regression test for this scenario.
v3.2.1
v3.2.1 adds handling for cases where the parent module is missing from the require cache, and for self-import scenarios. The implementation changes how the fresh module is re-required, adding a fallback to normal require when the parent cache entry is unavailable.
v3.2.0
v3.2.0 changes how import-fresh reloads modules so the reloaded module keeps a transparent parent relationship to the original caller. This is implemented by removing the cached module from its parent children list and then requiring the fresh module using the caller module's require method rather than requiring it directly from import-fresh's module context.
Breakingv3.1.0
Release v3.1.0 primarily adds TypeScript type definitions for import-fresh. The diff also updates tooling and CI configuration by adding tsd-based type tests and expanding the Travis Node.js matrix.
Featuresv3.0.0
v3.0.0 introduces a breaking platform requirement and improves the logic used to find modules to import. Developers upgrading should ensure their runtime matches the new Node.js requirement to avoid immediate startup or compatibility failures.
Breaking