标签: node.js node-modules require
最近,在使用 linter 时,我发现一些内置包的名称前面带有 node:。我搜索了很多,但没有得到任何有用的信息。这是什么 node:module 语法?
node:
node:module
答案 0 :(得分:3)
也可以使用 node: 前缀来识别核心模块,在这种情况下,它会绕过 require 缓存。例如, require('node:http') 将始终返回内置的 HTTP 模块,即使该名称存在 require.cache 条目。
https://nodejs.org/api/modules.html