A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mogelbrod/apply-loader below:

mogelbrod/apply-loader: Apply loader for webpack

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).

// Call with multiple arguments
// => sourceFn(1, 2)
require("apply?args[]=1&args[]=2!functionReturningLoader");

// Call with an object/array
// => sourceFn({a: 1, b:2})
require("apply?{obj: {a: 1, b: 2}}!functionReturningLoader");

// Call with an object/array declared in the webpack.config
// => sourceFn(require('webpack.config').customConfig)
require("apply?config=customConfig!functionReturningLoader");
use: [{
  loader: 'apply-loader',
  options: {
    // => sourceFn({a: 1}, true)
    args: [ {a: 1}, true ]
    // => sourceFn({a: 1})
    obj: {a: 1}
    // => sourceFn(require('webpack.config').customConfig)
    config: 'customConfig'
  }
}

MIT (http://www.opensource.org/licenses/mit-license.php)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4