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

@esbuild-kit/cjs-loader

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esbuild-kit/cjs-loader

Node.js loader for compiling ESM & TypeScript modules to CommonJS

  • 2.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
130K
decreased by-17.62%
Maintainers
1
Weekly downloads
 
Created

What is @esbuild-kit/cjs-loader?

@esbuild-kit/cjs-loader is an npm package that allows you to use ES modules (ESM) in CommonJS (CJS) environments. It leverages esbuild to transpile ESM to CJS on the fly, enabling seamless integration of modern JavaScript modules in older Node.js projects.

What are @esbuild-kit/cjs-loader's main functionalities?

Transpile ESM to CJS

This feature allows you to transpile ES modules to CommonJS on the fly. By registering the loader, you can require ESM files in a CJS environment.

const { register } = require('@esbuild-kit/cjs-loader');
register();
const esmModule = require('./esmModule.mjs');
console.log(esmModule);

Custom Loader Options

You can customize the loader options such as the target ECMAScript version and the output format. This provides flexibility in how the ESM is transpiled to CJS.

const { register } = require('@esbuild-kit/cjs-loader');
register({ target: 'es2017', format: 'cjs' });
const esmModule = require('./esmModule.mjs');
console.log(esmModule);

Other packages similar to @esbuild-kit/cjs-loader

Keywords

FAQs

Package last updated on 23 Jul 2022

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