Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joutvhu/babel-plugin-transform-node-module

This plugin transforms ES2015 modules to Node.js module system.
https://github.com/joutvhu/babel-plugin-transform-node-module

Last synced: 16 days ago
JSON representation

This plugin transforms ES2015 modules to Node.js module system.

Awesome Lists containing this project

README

        

# babel-plugin-transform-node-module
This plugin transforms ES2015 modules to Node.js module system.

## Installation

```bash
npm install --save-dev babel-plugin-transform-node-module
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
"plugins": ["transform-node-module"]
}
```

#### Options

- *`kind`* - A string value, specifying the type of variable used to import is "const", "let" or "var"..

```json
{
"plugins": [
["transform-node-module", { "kind": "const" }]
]
}
```

- *`module`* - A boolean value, that if true will use `module.exports` instead of `exports`.

```json
{
"plugins": [
["transform-node-module", { "module": true }]
]
}
```

### Via CLI

```bash
babel --plugins transform-node-module script.js
```