Gathering detailed insights and metrics for @small-tech/import-fresh
Gathering detailed insights and metrics for @small-tech/import-fresh
Gathering detailed insights and metrics for @small-tech/import-fresh
Gathering detailed insights and metrics for @small-tech/import-fresh
Import a fresh, uncached, version of an EcmaScript Module (ESM; aka ES6 module/JavaScript Module).
npm install @small-tech/import-fresh
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Stars
5 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Sep 03, 2023
Latest Version
1.0.1
Package Id
@small-tech/import-fresh@1.0.1
Unpacked Size
5.67 kB
Size
2.71 kB
File Count
7
NPM Version
6.14.10
Node Version
14.15.4
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Import a fresh, uncached version of an EcmaScript Module (ESM; aka ES6 module/JavaScript Module).
Note: This will leak memory and eventually crash your system. Garbage collecting stale ESM modules is not a solved problem as of Feb, 2021. Do not use this in production.
1importFresh(absolutePathToModule)
In module.mjs:
1export default (() => Math.random())
In index.mjs:
1import path from 'path' 2import importFresh from '@small-tech/importFresh' 3 4console.log((await importFresh(path.resolve('./module.mjs'))).default) 5console.log((await importFresh(path.resolve('./module.mjs'))).default)
Run index.mjs and note that you see two different random numbers.
Before you just npm install
this, ask yourself if you really need it.
If you’re only going to use this in one place, you can cache bust using a single line of vanilla JavaScript:
e.g.,
1const myModule = await import(`./my-module?update=${new Date()}`)
(Bonus: you won’t have to use absolute paths.)
And if you want to use it from several places in the same file, you can just make a simple function:
1function importFresh(modulePath) { 2 return await import(`${modulePath}?update=${new Date()}`) 3}
The only time this module really saves you any work is if you need this functionality from multiple files within your project.
So evaluate whether you need to use it and save a dependency if you don’t.
Small Technology Foundation is a tiny, independent not-for-profit.
We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.
© 2021 Aral Balkan, Small Technology Foundation.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More