Search code examples
javascriptecmascript-6systemjsjspm

Get list of all declared module imports (SystemJS)


I'm using jspm and SystemJS to import ES2015 modules.

Is it possible to get a list of all of the imported modules in a project through the System object, or anywhere else? I can access my project-specific modules through System._loader.moduleRecords, but the modules that I've installed through jspm (e.g., d3, jquery) do not appear in this list.

System._loader.modules contains a list of all modules, but unfortunately also includes a list of modules required to transpile my code and modules-loading packages.

System._loader.moduleRecords (project modules) enter image description here

System._loader.modules (project modules, libraries, transpile packages) enter image description here

I want only a list of declared imports, specifically, those that I've imported using import x from 'x'. This should include both project modules and libraries, but not babel/module-loading related modules. I'd like the solution to not involve filtering using regular expressions.


Solution

  • SystemJS Debugger is probably what you are looking for.