A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/mokkabonna/lodash-requirejs-loader-plugin below:

mokkabonna/lodash-requirejs-loader-plugin: A require js loader for lodash amd

lodash-requirejs-loader-plugin

A requirejs loader for lodash AMD modules. Prevents build bloat. Use what you need, include only those modules in your build.

Just use it like this:

define(['_!map,reduce,flatten'], function(_){

  //now _.map _.reduce and _.flatten is available to use as normal
  //...

});

This has no bower dependency to lodash. So install what version you desire yourself. The reason is because the way lodash has tagged it's AMD build this package can't specify something like lodash:^3.0.0-amd Because that will install the non AMD version of lodash. And I don't want to lock it down to a specific version, since that requires me to always update the map.

The map is based on lodash 3.10.1-amd.

See below for the overrides option to use with other versions of lodash.

Include it in your requirejs like this. (or use another name if you prefer)

{
  paths: {
    '_': 'bower_components/lodash-requirejs-loader-plugin/src/main'
  }
}

And as normal with lodash amd, include it like this, as a package:

{
  packages: [{
    name: 'lodash',
    location : 'bower_components/lodash'
  }]
}
Development optimizations

During development we will load just lodash and create a custom lodash with the requested modules. This is so that we can load faster. When you run the requirejs optimizer only the requested modules will be included.

If you want to disable this optimization you can do so like this in your requirejs config.

{
  config: {
    '_': { //use the name you gave it in the path config
      devOptimizedLoad: false
    }
  }
}

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