require-extension-hooks-babel-7

0.7.3 • Public • Published

require-extension-hooks-babel-7

Using require-extension-hooks you can transpile ES6/7/.. code to run in node. Although node supports 99.999% of ES6 features there is one major omission: export/import syntax.

On this fork

Differences from upstream:

  • Doesn't have any 'exclude' functionality, as this was being done twice anyhow

Installation

npm install require-extension-hooks require-extension-hooks-babel-7 --save-dev

Usage

const hooks = require('require-extension-hooks');
hooks('js').exclude(({filename}) => filename.match(/\/node_modules\//).plugin('babel', {}).push();
 
// elsewhere...
import {foo} from './foo';

Note: This fork makes no attempt to exclude files for you, you must specify an 'exclude' condition as shown above or things will go horribly wrong for you.

The second argument allows you to configure which options are passed into babel's transform function. By default this contains a node : current configuration to only use babel polyfills that node doesn't have.

Readme

Keywords

none

Package Sidebar

Install

npm i require-extension-hooks-babel-7

Weekly Downloads

34

Version

0.7.3

License

ISC

Unpacked Size

2.38 kB

Total Files

3

Last publish

Collaborators

  • pearofducks