Bublé require hook.
Based on the excellent babel-register and adapted for Bublé.
$ npm install --save buble-register
require('buble-register');
All subsequent files required with the extensions .js
, .jsx
, .es6
and .es
will be transformed by Bublé.
Type: Array
Default: ['.js', '.jsx', '.es6', '.es']
Extensions to install a require hook for.
Type: String
, Array<String, RegExp>
, Boolean
, RegExp
, Function
Patterns to ignore or exclusively include for compiling.
const bubleRegister = require('buble-register');
bubleRegister({
only: 'a.js'
});
bubleRegister({
only: ['a.js', 'b.js']
});
// override `node_modules` ignoring
bubleRegister({
only: false
});
bubleRegister({
only: /regex/
});
bubleRegister({
only: filename => {
if (filename === '/path/to/es6-file.js') {
return true;
} else {
return false;
}
}
});
Type: Boolean
Default: true
Enable or disable caching of compiled sources.
By default buble-register
saves to a file in temporary directory.
BUBLE_CACHE_PATH
Specify a different cache location.
BUBLE_CACHE_PATH=/path/to/cache.json node with-register.js
BUBLE_DISABLE_CACHE
Disable the cache.
BUBLE_DISABLE_CACHE=1 node with-register.js
MIT © Vadim Demedes