simple-functional-loader

1.2.1 • Public • Published

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

Package Sidebar

Install

npm i simple-functional-loader

Weekly Downloads

11,926

Version

1.2.1

License

MIT

Unpacked Size

6.51 kB

Total Files

9

Last publish

Collaborators

  • tingyuan