0.0.1 • Published 7 years ago

babel-query-loader v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

  • show required installations if some are missing
  • if they are missing, write out a line that shows the installation npm i command
  • stringify the object queries such as inferno for usage as a string
  • just loop instead of Object.assign, for compatibility, or use polyfill but that seems like overkill