在应用代码运行之前使用 data: URL 注册钩子


🌐 Registering hooks before application code runs with a data: URL

或者,可以将内联 JavaScript 代码嵌入到 data: URL 中,以便在应用代码运行之前注册钩子。例如,

🌐 Alternatively, inline JavaScript code can be embedded in data: URLs to register the hooks before the application code runs. For example,

node --import 'data:text/javascript,import {registerHooks} from "node:module"; registerHooks(/* hooks code */);' ./my-app.js