在编译 API 中支持动态 import()


【Support of dynamic import() in compilation APIs】

以下 API 支持 importModuleDynamically 选项,以启用在 vm 模块编译的代码中使用动态 import()

【The following APIs support an importModuleDynamically option to enable dynamic import() in code compiled by the vm module.】

  • new vm.Script
  • vm.compileFunction()
  • new vm.SourceTextModule
  • vm.runInThisContext()
  • vm.runInContext()
  • vm.runInNewContext()
  • vm.createContext()

此选项仍属于实验模块 API 的一部分。我们不建议在生产环境中使用它。

【This option is still part of the experimental modules API. We do not recommend using it in a production environment.】