change-default

Convert exports.default to module.exports for all .js files in specified directories


Keywords
module, change-default, exports.default, module.exports, convert-export-default, javascript, javascript-library, npm-module
License
ISC
Install
npm install change-default@1.1.1

Documentation

Change Default

Description

Convert exports.default to module.exports for all .js files in specified directories recursively

You can specify directory by --dir option

Note: it will not change if more exports are occurred

Installation

    npm install -g change-default

Github Repository Source Code

Usage

$: change-default --dir=build

--dir is optional

default dir is current directory

Examples

Before

function add(x, y) {
  return x + y;
}
exports.default = add;

After

function add(x, y) {
  return x + y;
}
module.exports = add;

Will not work when:

function add(x, y) {
  return x + y;
}
exports.owner = "Manick";
exports.default = add;

if there is more exports it will not change anything

License

The MIT License (MIT) - 2019