Invalidate cache when using import
未关闭
还没有人认领这个 Issue。
esm
feature request
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
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.
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.cacheis not used byimport. It has a separate cache.
— https://nodejs.org/api/esm.html#esm_no_require_cache
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中链接的 ESM 缓存部分开始,并结合包含 151 条评论的 thread 审查动态 import 示例。一次贡献需要有 maintainer 批准的范围——文档、API 或行为变更,或两者兼有——并说明验证缓存失效的方式;该 issue 目前没有提供这些内容。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100