3.3.1 • Published 4 months ago

import-fresh v3.3.1

Weekly downloads
27,229,256
License
MIT
Repository
github
Last release
4 months ago

import-fresh

Import a module while bypassing the cache

Useful for testing purposes when you need to freshly import a module.

ESM

For ESM, you can use this snippet:

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

npm install import-fresh

Usage

// foo.js
let i = 0;
module.exports = () => ++i;
const importFresh = require('import-fresh');

require('./foo')();
//=> 1

require('./foo')();
//=> 2

importFresh('./foo')();
//=> 1

importFresh('./foo')();
//=> 1

Related

cosmiconfig@eslint/eslintrc@huyhpham/rn-linearchetype-libraryeasy-select-rnvuedragdropuploadimages@docusaurus-azuread/plugin-content-docs@jerryhorak/docusaurus-corereact-native-bluetooth2killi8n-react-native-fast-imagepipihomern-send-sms@icanpm/api-master@oneplanetcrowd/developers@tailwindcssinjs/typescript-plugin@cashremit/cr-streamline-icons@almeidaa/msa-xyj-testreact-native-template-rfbasetypescript-tailwindcssinjs-plugincloud-archive-s3airscanairscan-examplebb-chat@twstyled/babelreact-native-esc-pos-sahaab@twstyled/babel-plugin@twstyled/babel-plugin-tw@borisovart/atol-kkt-module@frxf/frxfdeneme323112@fundefund/funde_ck@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_modafryxiconsreact-native-thanh-toast-library@jttechnic/interpreter@thanhnguyen14797/react-native-thanh-toast-library@eginnovations/eginnovations-capacitor-plugin@saeon/quick-formnocodb1@iobroker-community-adapters/iobroker.device-watcher@olivervorasai/slidermysql-formatreact-native-printer-brothersrn-pdf-reader-offline@belko.tech/belko-multi-wallet-sdk@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutils@everything_explained/web-md-bundleruncoded-connect@reversodev/oceanic-fleetwilscanner@khalitovadel/abstract-repository@oiti/documentoscopy-react-native@respondea/cordova-plugin-v-inappbrowser@mink-opn/build-tokensquoc-testreact-native-slider-kf@hotfusion/service@infinitebrahmanuniverse/nolb-imp@prodam/prodam-types@saaspe/componentsplginexpand-react-bridgeopea-bootstraapnocodb-dailyluminos-ui-coresklif-ui-kitsklif-apits-handyicg-crawler@everything-registry/sub-chunk-1908jawwy-sdkjawwy_gamification_release@deepakorg/test@deepak757/testreact-native-sphereuisphereuijawwy_libraryeginnovations-capacitor-pluginreact-native-credit-card-pkgp149-table@rabailriaz/hisaab-web-portalsklif-uimachinebeemrcaps@mediakular/svelte-data-gridreact-native-jawwy_samplegriffin-ui-libraryjualwkakokowawkzl2kzl3kzl4kzl5mamaow
3.3.1

4 months ago

3.3.0

4 years ago

3.2.2

5 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.0.0

8 years ago