@putout/plugin-convert-esm-to-commonjs
v6.0.2
Published
šPutout plugin adds ability to convert ecma script module to commonjs
Downloads
42,058
Maintainers
Readme
@putout/plugin-convert-esm-to-commonjs
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 theexport
statement in another file.CommonJS is a module system supported in Node, it provides a
require
function, which can be used to access theexports
object exposed by another file.(c) parceljs
šPutout plugin adds ability to convert EcmaScript Modules to CommonJS. Use @putout/plugin-nodejs
instead.
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