create-functional-loader
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

create-functional-loader

This is a fork of simple-functional-loader but rewrite with Typescript for TypeStrong !

Use function as webpack loader option

Install

<npm|yarn|pnpm> i -D create-functional-loader

Usage

// webpack.config.js
const { createLoader } = require('create-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 function will return UseEntry object:

{
  loader: string,
  options: object,
  ident: string
}

Package Sidebar

Install

npm i create-functional-loader

Weekly Downloads

6

Version

0.1.4

License

ISC

Unpacked Size

6.7 kB

Total Files

8

Last publish

Collaborators

  • icebreaker