JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 35
  • Score
    100M100P100Q69647F
  • License ISC

forked from `simple-functional-loader` and rewrite by typescript

Package Exports

  • create-functional-loader
  • create-functional-loader/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (create-functional-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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
}