apply loader for webpack
Usage
Documentation: Using loaders
The apply
loader can be used to execute an exported JavaScript function (optionally with arguments) and export the returned value.
It will attempt to call the default
export if defined, falling back to the basic export (i.e. module.exports
).
require("apply?args[]=1&args[]=2!functionReturningLoader");
require("apply?{obj: {a: 1, b: 2}}!functionReturningLoader");
require("apply?config=customConfig!functionReturningLoader");
Webpack 2 configuration
use: [{
loader: 'apply-loader',
options: {
args: [ {a: 1}, true ]
obj: {a: 1}
config: 'customConfig'
}
}
License
MIT (http://www.opensource.org/licenses/mit-license.php)