simple-functional-loader

v1.0.1
use function as webpack loader option
webpack loader function inline functional

simple-functional-loader

Use function as webpack loader option

npm version Build Status

install

npm install simple-functional-loader --save-dev

usage

// webpack.config.js
const { createLoader } = require('simple-functional-loader')
module.exports = {
  //...
  module: {
    rules: [
      {
        test: /\.html$/,
        use: [
          createLoader(function(source, map) { // must be an "ES5" function!
            // use "this" as loaderContext
            return processHTML(source, map) // process source code.
          })
        ]
      }
    ]
  }
}

createLoader will return UseEntry object:

{
  loader: string,
  options: object
}

license

MIT

Metadata

  • MIT
  • Whatever
  • tingyuan
  • released 11/28/2018

Downloads

Maintainers