compile-esx-sync
v1.0.15
Published
compile es6/7... code to es5
Downloads
4
Readme
What
compile-esx-sync
can compile es6(es7 .etc) code in src folder/file to es5 code in target folder/file in sync mode.
How
/**
* @param {string} srcFileOrFolderPath - src file or folder path; relative or absolute
* @param {string} targetFileOrFolderPath - target file or folder path; relative or absolute
* @param {Object} config - config, including: watch/include/exclude
* @param {boolean} config.watch - false by default; watch file changes: add/change/unlink/unlinkDir
* @param {RegExp} config.include - /\.js$/ by default; will only compile files whose path matched this
* @param {RegExp} config.exclude - null by default; will not compile files whose path matched this
* @param {Array} config.presets - ['es2015'] by default; for babel config
* @return undefined
*/
compileEsx(srcFileOrFolderPath, targetFileOrFolderPath[, config]);
Example
const compileEsxSync = require('compile-esx-sync');
compileEsxSync('./src', './target', {
watch: true,
include: /\.js/,
exclude: /node\_modules/
});
When
When you don't want to write webpack.config.js
when coding node modules, but the same time also want to write es6/7..., you can use compile-esx
and open the watch
config to compile es6/7... code to es5.
const compileEsxSync = require('compile-esx-sync');
compileEsxSync('./src', './dist', {
watch: true
});