An open API service indexing awesome lists of open source software.

https://github.com/lovetingyuan/simple-functional-loader

Use function as webpack loader option.
https://github.com/lovetingyuan/simple-functional-loader

function inline-function loader webpack

Last synced: about 1 month ago
JSON representation

Use function as webpack loader option.

Awesome Lists containing this project

README

        

# simple-functional-loader
Use function as webpack loader option

[![npm version](https://img.shields.io/npm/v/simple-functional-loader.svg)](https://www.npmjs.com/package/simple-functional-loader)
[![Build Status](https://travis-ci.org/lovetingyuan/simple-functional-loader.svg?branch=master)](https://travis-ci.org/lovetingyuan/simple-functional-loader)

## install
```bash
npm install simple-functional-loader --save-dev
```

## usage
```javascript
// 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`](https://webpack.js.org/configuration/module/#useentry) object:
```
{
loader: string,
options: object
}
```

## license
MIT