@w3ctech-editorial-department/think-babel

2.0.0 • Public • Published

think-babel

Build Status Coverage Status npm version

think-babel transpile ES6+ file to ES5

Syntax

import thinkBabel from 'think-babel';
thinkBabel({
  srcPath,
  outPath,
  file,
  options,
  ext,
});
  • srcPath {String} the file source path.

  • outPath {String} the directory for output file.

  • file {String} the file path in the 'srcPath'.

  • [options] {Object} the babel options,default

    {
      filename: file,
      sourceFileName: path.join(srcPath, file),
      presets: ['es2015'],
      sourceMaps: true,
      babelrc: false
    }
  • [ext] {String} the new file extension,default .js.

Usage

Transform ES6+ file to ES5:

import thinkBabel from 'think-babel';

thinkBabel({
  srcPath: './test/src/a',
  outPath: './test/out',
  file: 'b/test.es'
});

Readme

Keywords

Package Sidebar

Install

npm i @w3ctech-editorial-department/think-babel

Weekly Downloads

0

Version

2.0.0

License

ISC

Unpacked Size

5.69 kB

Total Files

8

Last publish

Collaborators

  • ginny315
  • liuliangsir