# node-export-map

> Userland module that implements the module path mapping that Node.js does with "exports" in package.json

Latest version **1.0.0** (published 2022-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-export-map
pnpm add node-export-map
yarn add node-export-map
bun add node-export-map
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-01-26 |
| First published | 2022-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/node-export-map
- Repository: https://github.com/mafintosh/node-export-map
- Issues: https://github.com/mafintosh/node-export-map/issues
- npm.io page: https://npm.io/package/node-export-map

## Recent versions

- 1.0.0 (latest) — 2022-01-26
- 0.0.0 — 2022-01-26

## README

# node-export-map

Userland module that implements the module path mapping that Node.js does with "exports" in package.json

```
npm install node-export-map
```

## Usage

``` js
const nem = require('node-export-map')

// Specify the runtimes you support
const runtimes = new Set(['import'])

// Get an export map somewhere, this one is from preact
const exportMap = {
  ".": {
    "browser": "./dist/preact.module.js",
    "umd": "./dist/preact.umd.js",
    "import": "./dist/preact.mjs",
    "require": "./dist/preact.js"
  },
  "./compat": {
    "browser": "./compat/dist/compat.module.js",
    "umd": "./compat/dist/compat.umd.js",
    "require": "./compat/dist/compat.js",
    "import": "./compat/dist/compat.mjs"
  }
}

// And map a path

const main = nem(exportMap, runtimes, '.')
console.log(main) // prints ./dist/preact.mjs

const compact = nem(exportMap, runtimes, './compat')
console.log(compact) // prints ./compat/dist/compat.mjs

const unknown = nem(exportMap, runtimes, './foobarbaz')
console.log(unknown) // is null
```

## License

MIT

---
_Source: https://npm.io/package/node-export-map · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
