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

esm

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm

Tomorrow's ECMAScript modules today!

  • 3.2.25
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7M
increased by4.86%
Maintainers
1
Weekly downloads
 
Created

What is esm?

The esm npm package is a lightweight module loader that allows developers to use ES6 modules in Node.js. It enables the use of import and export syntax for working with modules, which is more standardized and often considered cleaner than the traditional CommonJS require syntax.

What are esm's main functionalities?

Import ES6 Modules

Allows the use of ES6 import syntax in Node.js by requiring the esm module and then using it to load other ES6 modules.

require = require('esm')(module)
const { myFunction } = require('./myModule.mjs')

Export ES6 Modules

Enables developers to define modules using ES6 export syntax, which can then be imported by other modules.

// In myModule.mjs
export const myFunction = () => { console.log('Hello ESM!'); }

Dynamic Import

Supports dynamic import() syntax for loading modules asynchronously, which can be useful for code splitting or on-demand loading.

require = require('esm')(module)
const myModule = require('./myModule.mjs')
myModule.then(module => { module.myFunction() })

Other packages similar to esm

Keywords

FAQs

Package last updated on 17 May 2019

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