如何在使用 ESM 时自动重新加载 Node.js 中的文件?
How to auto-reload files in Node.js while using ESM?
我知道您可以在使用 CommonJS 时从缓存中清除文件,只需从 require.cache
中 delete
ing 并再次 require
ing 文件即可。但是,在使用 ESM 时,我一直找不到等效的选项。这可能吗?如果可能的话怎么办?
在 esm issues 读取似乎缓存是故意不公开的。
恐怕你的问题的答案很简单没有。
我知道您可以在使用 CommonJS 时从缓存中清除文件,只需从 require.cache
中 delete
ing 并再次 require
ing 文件即可。但是,在使用 ESM 时,我一直找不到等效的选项。这可能吗?如果可能的话怎么办?
在 esm issues 读取似乎缓存是故意不公开的。
恐怕你的问题的答案很简单没有。