create-functional-loader

v0.1.0
forked from `simple-functional-loader` and rewrite by typescript
webpack webpack-loader simple functional simple-functional-loader

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
}

Metadata

  • ISC
  • Whatever
  • SonOfMagic
  • released 6/15/2023

Downloads

Maintainers