@node-loader/import-maps
npm i @node-loader/import-maps

@node-loader/import-maps

A nodejs loader for import maps

by node-loader

1.0.3 (see all)License:MITTypeScript:Not Found
npm i @node-loader/import-maps
Readme

@node-loader/import-maps

A nodejs loader for import maps. This allows you to customize module resolution by creating a node.importmap file.

Installation

npm install --save @node-loader/import-maps

# Or, if you prefer Yarn
yarn add --save @node-loader/import-maps

Usage

Create a file node.importmap in the current working directory:

{
  "imports": {
    "my-module": "file:///Users/name/code/my-module.js"
  }
}

Now create a file that imports the mapped module:

import "my-module";

Now run node with the --experimental-loader flag:

node --experimental-loader @node-loader/import-maps file.js

Configuration

By default, node-loader import maps looks for a configuration file called node.importmap in the current working directory. To specify the file path to the configuration file, provide the IMPORT_MAP_PATH environment variable:

IMPORT_MAP_PATH=/Users/name/some/dir/node.importmap node --experimental-loader @node-loader/import-maps file.js

Composition

If you wish to combine import maps with other NodeJS loaders, you may do so by using node-loader-core.

Downloads/wk

327

GitHub Stars

32

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.3
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial