简体   繁体   中英

Debugging SystemJS module loading?

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?

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' }
    };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM