Skip to content

WebReflection/modules-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modules Map

Build Status Coverage Status

A map (extend) to register urls for modules as potential solution to this problem and import via get(module).

// the module owner could register the module
import Modules from 'modules-map';
Modules.set('my-module', 'https://unpkg.com/my-module?module');

// the module consumer can verify it's been registered
import Modules from 'modules-map';
if (Modules.has('my-module'))
  Modules.get('my-module').then(module => {
    module.doStuff();
  });

The module itself registers the global Mpdules map helper so that modules, bundlers, or even runtime scripts, can all benefit from the shared registry.

Note this module requires browsers compatible with ES2015 and dynamic import(...) so it cannot work in IE11 or lower.

About

A map to register urls for modules

Resources

License

Stars

Watchers

Forks

Packages

No packages published