{"id":20552,"library":"simple-functional-loader","title":"simple-functional-loader","description":"Allows using a JavaScript function as a Webpack loader configuration option. Version 1.2.1 simplifies custom inline loaders by wrapping a function into a loader path and options. The package is stable but has seen infrequent updates, with v1.1.2 fixing a security issue. Most development happens in the webpack ecosystem itself.","status":"active","version":"1.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/lovetingyuan/simple-functional-loader","tags":["javascript","webpack","loader","function","inline","functional"],"install":[{"cmd":"npm install simple-functional-loader","lang":"bash","label":"npm"},{"cmd":"yarn add simple-functional-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-functional-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: designed to be used with webpack","package":"webpack","optional":false}],"imports":[{"note":"The package exports createLoader as a named export, not default.","wrong":"import createLoader from 'simple-functional-loader'","symbol":"createLoader","correct":"import { createLoader } from 'simple-functional-loader'"},{"note":"CJS destructured import is required; direct assignment gives an object.","wrong":"const createLoader = require('simple-functional-loader')","symbol":"createLoader (CJS)","correct":"const { createLoader } = require('simple-functional-loader')"},{"note":"When used as an inline loader, prepend with '!' to avoid other loaders.","wrong":null,"symbol":"inline loader usage","correct":"import source from '!simple-functional-loader!./file.txt'"}],"quickstart":{"code":"// webpack.config.js\nconst { createLoader } = require('simple-functional-loader');\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.txt$/,\n        use: createLoader(function(source) {\n          // This function runs as a webpack loader.\n          // 'this' is the loader context.\n          return source.toUpperCase();\n        })\n      }\n    ]\n  }\n};","lang":"javascript","description":"Demonstrates wrapping a custom function as a webpack loader using createLoader."},"warnings":[{"fix":"Use function() { ... } instead of () => { ... }.","message":"The function passed to createLoader must be an 'ES5' function (not arrow) to access the loader context via 'this'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with webpack 5; consider using webpack's built-in loader.","message":"The package has not been updated since 2019; webpack 5 compatibility is not guaranteed.","severity":"deprecated","affected_versions":">=1.1.2"},{"fix":"Update to version >=1.1.2.","message":"v1.1.2 fixed a security issue; upgrade from earlier versions.","severity":"breaking","affected_versions":"<1.1.2"}],"env_vars":null,"search_vec":"'1.2.1':17 'allow':5 'configur':14 'custom':19 'develop':48 'ecosystem':53 'fix':43 'function':3,9,25,58,60 'happen':49 'infrequ':39 'inlin':20,59 'issu':46 'javascript':8,55 'loader':4,13,21,28,57 'option':15,31 'packag':33 'path':29 'secur':45 'seen':38 'simpl':2 'simple-functional-load':1 'simplifi':18 'stabl':35 'updat':40 'use':6 'v1.1.2':42 'version':16 'webpack':12,52,56 'wrap':23","created_at":"2026-04-25T11:23:42.831233+00:00","updated_at":"2026-04-25T11:23:42.831233+00:00","problems":[{"fix":"Replace arrow function with a regular function expression.","cause":"Using arrow function which doesn't have 'this' binding.","error":"TypeError: loader is not a function"},{"fix":"npm install simple-functional-loader --save-dev","cause":"Package not installed or missing from devDependencies.","error":"Module not found: Error: Can't resolve 'simple-functional-loader'"},{"fix":"Ensure createLoader receives a function as the only argument.","cause":"Using createLoader without a function argument or invalid path.","error":"Error: Cannot find module './path/to/loader'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/lovetingyuan/simple-functional-loader","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/simple-functional-loader","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}