Skip to content

Latest commit

 

History

History
 
 

plugin-convert-esm-to-commonjs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@putout/plugin-convert-esm-to-commonjs NPM version

EcmaScript module syntax is the standard way to import and export values between files in JavaScript. The import statement can be used to reference a value exposed by the export statement in another file.

CommonJS is a module system supported in Node, it provides a require function, which can be used to access the exports object exposed by another file.

(c) parceljs

🐊Putout plugin adds ability to convert EcmaScript Modules to CommonJS.

Install

npm i @putout/plugin-convert-esm-to-commonjs

Rule

{
    "rules": {
        "convert-esm-to-commonjs": "on"
    }
}

❌ Example of incorrect code

import hello from 'world';

✅ Example of correct code

const hello = require('world');

License

MIT