Invalidate cache when using import
How do I invalidate the cache of `import`? I have a function that installs missing modules when an import fails, but the `import` statement seems to preserve the failure while the script is still running. ```js import('some-module').catch( // this catch will only be reached the first time the script is run because resolveMissingModule will successfully install the module () => resolveMissingModule('some-module').then( // again, this will only be reached once, but it will fail, because the import seems to have cached the previous failure () => import('some-module') ) ) ``` The only information I found in regards to import caching was this documentation, which does not tell me where the “separate cache” used by `import` can be found. > ### No require.cache > `require.cache` is not used by `import`. It has a separate cache. > — https://nodejs.org/api/esm.html#esm_no_require_cache
Posted by jonathantneal on Apr 5, 2019, 4:56 PM
Tags
Related issues
- The issue is really the extreme difficulty of programming them, especially for anything sequential (rather than combinatorial).
- I probably could have beared with it if it was only limited to programming, but it showing up in creative fields has made me feel all sor...
- I hate that I'm in deep enough to know what you mean.
- The biggest problem with “AI” is that big corps are shoving it down our throats.
- in the middel of a coding session with 5.6 sol.
- [Hero Run] 535B-A23B on 18T tokens
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
reliability (Other)
The issue is really the extreme difficulty of programming them, especially for anything sequential (rather than combinatorial).
I probably could have beared with it if it was only limited to programming, but it showing up in creative fields has made me feel all sor...
I hate that I'm in deep enough to know what you mean.
The biggest problem with “AI” is that big corps are shoving it down our throats.
in the middel of a coding session with 5.6 sol.
[Hero Run] 535B-A23B on 18T tokens
I hate that this is how AI is being used..
inexperienced protobuf user here -- why do non-googlers generally use protobuf?
Invalidate cache when using import
How do I invalidate the cache of `import`? I have a function that installs missing modules when an import fails, but the `import` statement seems to preserve the failure while the script is still running. ```js import('some-module').catch( // this catch will only be reached the first time the script is run because resolveMissingModule will successfully install the module () => resolveMissingModule('some-module').then( // again, this will only be reached once, but it will fail, because the import seems to have cached the previous failure () => import('some-module') ) ) ``` The only information I found in regards to import caching was this documentation, which does not tell me where the “separate cache” used by `import` can be found. > ### No require.cache > `require.cache` is not used by `import`. It has a separate cache. > — https://nodejs.org/api/esm.html#esm_no_require_cache
Comments (0)
No comments yet. Start the discussion.