--import=module


稳定性: 1 - 实验性

在启动时预加载指定的模块。如果该标志被多次提供,每个模块将按它们出现的顺序依次执行,首先是 NODE_OPTIONS 中提供的模块。

【Preload the specified module at startup. If the flag is provided several times, each module will be executed sequentially in the order they appear, starting with the ones provided in NODE_OPTIONS.】

遵循 ECMAScript 模块 分辨率规则。 使用 --require 加载 CommonJS 模块。 使用 --require 预加载的模块将在使用 --import 预加载的模块之前运行。

【Follows ECMAScript module resolution rules. Use --require to load a CommonJS module. Modules preloaded with --require will run before modules preloaded with --import.】

模块会被预加载到主线程以及任何工作线程、派生进程或集群进程中。

【Modules are preloaded into the main thread as well as any worker threads, forked processes, or clustered processes.】