purpose
an easy string or object babel loader
installation
npm i --save-dev babel-loader-builder
usage
(in webpack.config
)
as a string
import babelBuilder from 'babel-loader-builder'
const babelLoaderString = babelBuilder({cacheDirectory: false, moduleExports: false})
loaders: [
{
test: /\.js?$/,
loaders: babelLoaderString,
}
],
as an object
import babelBuilder from 'babel-loader-builder'
const babelLoaderObject = babelBuilder({asObject: true, inferno: true, cacheDirectory: false})
loaders: [
{
test: /\.js?$/,
loaders: 'babel-loader',
query: loader,
}
],
defaults
var defaults = {
hot: false,
react: false,
asObject: false,
production: false,
babelrc: false,
cacheDirectory: true,
babili: false,
moduleExports: true,
inferno: false,
}
todo