--entry-url
稳定性: 1 - 实验性的
¥Stability: 1 - Experimental
如果存在,Node.js 会将入口点解释为 URL,而不是路径。
¥When present, Node.js will interpret the entry point as a URL, rather than a path.
遵循 ECMAScript 模块 解析规则。
¥Follows ECMAScript module resolution rules.
URL 中的任何查询参数或哈希都可以通过 import.meta.url
访问。
¥Any query parameter or hash in the URL will be accessible via import.meta.url
.
node --entry-url 'file:///path/to/file.js?queryparams=work#and-hashes-too'
node --entry-url --experimental-strip-types 'file.ts?query#hash'
node --entry-url 'data:text/javascript,console.log("Hello")'