Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

add-esmodule

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

add-esmodule

Add __esModule property to native ES module objects

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

npm install --save add-esmodule

# alternative
yarn add add-esmodule

Usage

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

Keywords

FAQs

Package last updated on 13 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc