# add-esmodule

> Add __esModule property to native ES module objects

Latest version **1.0.0** (published 2020-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install add-esmodule
pnpm add add-esmodule
yarn add add-esmodule
bun add add-esmodule
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-09-13 |
| First published | 2020-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Joel Denning |
| Maintainers | joeldenning |
| Keywords | __esModule, module, interop, commonjs, cjs |

## Links

- npm: https://www.npmjs.com/package/add-esmodule
- Repository: https://github.com/joeldenning/add-esmodule
- Homepage: https://github.com/joeldenning/add-esmodule#readme
- Issues: https://github.com/joeldenning/add-esmodule/issues
- npm.io page: https://npm.io/package/add-esmodule

## Recent versions

- 1.0.0 (latest) — 2020-09-13

## README

# add-esmodule

Add \_\_esModule property to native ES module objects

## Motivation

Much of the javascript ecosystem relies of ES modules having an `__esModule` property. However, native ES modules do not have that property. This project is a workaround for that problem.

## Installation

```sh
npm install --save add-esmodule

# alternative
yarn add add-esmodule
```

## Usage

```js
import foo from "foo";
import { cloneWithEsModuleProperty } from "add-esmodule";

const fooCompat = cloneWithEsModuleProperty(foo);

foo.__esModule; // undefined
fooCompat.__esModule; // true
```

## Browser compatibility

add-esmodule works in IE 11+

## Implementation notes

- Live Bindings for modules are supported (via object getters on the cloned object)
- The cloned module object is frozen
- Symbols, including toString, are properly cloned

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