Skip to content

Easily install, configure and compose Node.js ESM loaders.

License

Notifications You must be signed in to change notification settings

targos/multiloader

Repository files navigation

multiloader

Easily install, configure and compose Node.js ESM loaders.

Warning

This module is experimental and the API is definitely going to change.
Feel free to play with it and give feedback but don't use it in production :).

Getting started

Start by installing the orchestrator:

npm install @multiloader/loader

Then create a file in your project. This will be the entrypoint of your custom loader:

touch loader.mjs

Start with the following piece of code. It creates a loader that does nothing:

export * from '@multiloader/loader';
import configureLoader from '@multiloader/loader';

configureLoader();

Then install and add all the loaders that you need. We'll use the https loader as an example.

Install the additional loader:

npm install @multiloader/https

Edit loader.mjs:

 export * from '@multiloader/loader';
 import configureLoader from '@multiloader/loader';
+import https from '@multiloader/https';

-configureLoader();
+configureLoader(https());

That's it! You can now import modules from "https:" URLs.

About

Easily install, configure and compose Node.js ESM loaders.

Resources

License

Stars

Watchers

Forks

Packages

No packages published