Reputation: 29234
I'm having an incredibly hard time understanding the modules and need a way to debug my issues. Is there a way to enumerate modules and their exports using SystemJS?
The config file seems like a poorly documented minefield. For modules that supply bundles like 'RxJs', if I include the bundle in a script tag or if I try to get it to load using the SystemJS config, how can I tell what I should be able to find in what I've loaded and where it is at? For instance I can get rxjs
to work by copying the node_modules/rxjs
to `wwwroot/libs/rxjs' and using this:
System.config({
map: {
'rxjs': 'lib/rxjs'
},
packages: {
'rxjs': { defaultExtension: 'js' }
}
This seems to load each individual file. Now say I use a script tag to load the rxjs bundle. How can I tell that the bundle has the modules I need? Is there a way in SystemJS to see if it would use the bundle and what it could resolve to?
Upvotes: 30
Views: 1521
Reputation: 1044
System.entries
Allows you to retrieve all modules in the System registry. Each value will be an array with two values: a key and the module.
for (const [id, ns] of System.entries()) {
console.log(id); // 'http://localhost/path-to-file.js'
console.log(ns); // { exportName: 'value' }
};
Upvotes: 1