Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
432 bytes
|
Line | |
---|
1 | /**
|
---|
2 | Import a module while bypassing the cache.
|
---|
3 |
|
---|
4 | @example
|
---|
5 | ```
|
---|
6 | // foo.js
|
---|
7 | let i = 0;
|
---|
8 | module.exports = () => ++i;
|
---|
9 |
|
---|
10 | // index.js
|
---|
11 | import importFresh = require('import-fresh');
|
---|
12 |
|
---|
13 | require('./foo')();
|
---|
14 | //=> 1
|
---|
15 |
|
---|
16 | require('./foo')();
|
---|
17 | //=> 2
|
---|
18 |
|
---|
19 | importFresh('./foo')();
|
---|
20 | //=> 1
|
---|
21 |
|
---|
22 | importFresh('./foo')();
|
---|
23 | //=> 1
|
---|
24 |
|
---|
25 | const foo = importFresh<typeof import('./foo')>('./foo');
|
---|
26 | ```
|
---|
27 | */
|
---|
28 | declare function importFresh<T>(moduleId: string): T;
|
---|
29 |
|
---|
30 | export = importFresh;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.