Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 6, 2023
1 parent f1dddc0 commit 75e8b16
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/funding.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- 8
- 6
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"email": "[email protected]",
"url": "https://sindresorhus.com"
},
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=6"
},
Expand Down
18 changes: 12 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
Useful for testing purposes when you need to freshly import a module.

## ESM

For ESM, you can use this snippet:

```js
const importFresh = moduleName => import(`${moduleName}?${Date.now()}`);

const {default: foo} = await importFresh('foo');
```

**This snippet causes a memory leak, so only use it for short-lived tests.**

## Install

```
Expand Down Expand Up @@ -34,12 +46,6 @@ importFresh('./foo')();
//=> 1
```

## import-fresh for enterprise

Available as part of the Tidelift Subscription.

The maintainers of import-fresh and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

## Related

- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache
Expand Down

0 comments on commit 75e8b16

Please sign in to comment.