node.js - 如何在 deno 中删除运行时导入缓存?

标签 node.js deno

在 node.js 我们可以使用

delete require.cache[require.resolve(somePath)];

在运行时删除需要缓存。

有没有类似的方法来删除 deno 中的运行时导入缓存?

最佳答案

-r--reload选项将重新编译导入的模块。

-r, --reload=<CACHE_BLACKLIST>     Reload source code cache (recompile TypeScript)

https://deno.land/manual#other-key-behaviors

Other key behaviors

  • Remote code is fetched and cached on first execution, and never updated until the code is run with the --reload flag. (So, this will still work on an airplane.)
  • Modules/files loaded from remote URLs are intended to be immutable and cacheable.


您可以传递参数以重新加载特定模块:
--reload=https://deno.land/std

https://deno.land/manual/linking_to_external_code/reloading_modules

关于node.js - 如何在 deno 中删除运行时导入缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61903993/

相关文章:

javascript - Nuxt 抛出 'The "path"argument must be of type string' or console spam

javascript - Firebase云函数返回错误错误: There is no user record corresponding to the provided identifier

typescript - Deno(typescript) 中的 Promise { <pending> }

command-line-interface - 从 CLI 将字符串通过管道传输到 Deno

javascript - 我可以使用 express.js 创建 web api 而没有安装 node.js 吗?

javascript - 使用 grunt-contrib-connect 和 grunt-contrib-watch 实时重新加载

node.js - 如何使用 TypeScript 在 Electron 中使用 remote.require()

javascript - 德诺: "Classic workers are not supported"?

javascript - 使用天龙时如何避免权限问题

javascript - RegEx 解析中间的 MIME 消息体。如何?