Skip to content

WebReflection/mjs-require

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mjs-require

Making npm CommonJS based modules available in NodeJS ESM.

alternative

Use @std/esm and configure it as such:

"@std/esm": {
  "cjs": true,
  "esm": "js"
}

How to install

You can install it either globally or locally, and use it in latter case via npm scripts.

npm install -g mjs-require

How to use

Require the module before launching your ESM based project.

node -r mjs-require --experimental-modules index.mjs

Why

Right now there's no conditional, dynamic, synchronous way to require CJS modules.

So now require is back.

Happy ESM Migration 🎉

About

Making npm CommonJS modules available in NodeJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published