我很难理解模块,需要一种方法来调试我的问题。有没有办法使用SystemJS枚举模块及其导出?
配置文件似乎是一个记录不完整的雷区。对于提供像“RxJs”这样的捆绑包的模块,如果我将捆绑包包含在脚本标记中,或者如果我尝试使用SystemJS配置加载它,我该怎么知道我 应该 能够找到我已加载的内容以及它的位置?例如,我可以通过将rxjs
复制到`wwwroot / libs / rxjs'并使用它来获得node_modules/rxjs
:
System.config({
map: {
'rxjs': 'lib/rxjs'
},
packages: {
'rxjs': { defaultExtension: 'js' }
}
这似乎加载了每个单独的文件。现在说我使用脚本标记来加载rxjs包。我怎么知道捆绑包有我需要的模块? SystemJS中是否有一种方法可以查看它是否会使用该包及其可以解决的内容?
答案 0 :(得分:1)
System.entries
允许您检索系统注册表中的所有模块。每个值都是具有两个值的数组:键和模块。
for (const [id, ns] of System.entries()) {
console.log(id); // 'http://localhost/path-to-file.js'
console.log(ns); // { exportName: 'value' }
};