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.
- Host: GitHub
- URL: https://github.com/lovetingyuan/simple-functional-loader
- Owner: lovetingyuan
- License: mit
- Created: 2018-11-27T07:01:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:36:57.000Z (over 2 years ago)
- Last Synced: 2025-04-23T11:41:01.155Z (about 2 months ago)
- Topics: function, inline-function, loader, webpack
- Language: JavaScript
- Homepage:
- Size: 187 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-functional-loader
Use function as webpack loader option[](https://www.npmjs.com/package/simple-functional-loader)
[](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