mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-18 14:53:14 +00:00
524 B
524 B
ES6 modules can check their own name from the global variable __moduleName. __moduleAddress is also available.
In CommonJS and AMD, this is available at module.id.
This allows easy relative dynamic loading, allowing modules to load additional functionality after the initial load:
export function moreFunctionality() {
return System.import('./extrafunctionality', { name: __moduleName });
}
This can be useful for modules that may only know during runtime which functionality they need to load.