package
Import ES modules without cache.
npm install import-without-cacheGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
7.6 kB
Includes dependencies.
Import ES modules without cache.
npm i import-without-cacheimport { 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.
clearRequireCache works, but init is unnecessary because ESM imports behave the same as CommonJS requires.clearRequireCache.require(esm) is supported starting in Node.js v24.13.1.MIT License © 2025-PRESENT Kevin Deng