sourceTextModule.moduleRequests


  • 类型:ModuleRequest[] 该模块的依赖。

此模块所需的导入依赖。返回的数组是冻结的,不允许对其进行任何更改。

【The requested import dependencies of this module. The returned array is frozen to disallow any changes to it.】

例如,给定一个源文本:

【For example, given a source text:】

import foo from 'foo';
import fooAlias from 'foo';
import bar from './bar.js';
import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
import source Module from 'wasm-mod.wasm'; 

sourceTextModule.moduleRequests 的值将是:

【The value of the sourceTextModule.moduleRequests will be:】

[
  {
    specifier: 'foo',
    attributes: {},
    phase: 'evaluation',
  },
  {
    specifier: 'foo',
    attributes: {},
    phase: 'evaluation',
  },
  {
    specifier: './bar.js',
    attributes: {},
    phase: 'evaluation',
  },
  {
    specifier: '../with-attrs.ts',
    attributes: { arbitraryAttr: 'attr-val' },
    phase: 'evaluation',
  },
  {
    specifier: 'wasm-mod.wasm',
    attributes: {},
    phase: 'source',
  },
];