🌐 AI搜索 & 代理 主页
Skip to content

droidenator/lodash-webpack-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lodash-webpack-plugin v0.1.0

Create smaller Lodash builds by replacing feature sets of modules with noop, identity, or simpler alternatives.

Install

$ npm i --save-dev lodash-webpack-plugin babel-core babel-loader babel-plugin-lodash babel-preset-es2015 webpack

Usage

webpack.config.js
var LodashReplacementPlugin = require('lodash-webpack-plugin');
var webpack = require('webpack');

module.exports = {
'module': {
  'loaders': [{
    'loader': 'babel-loader',
    'test': /\.js$/,
    'exclude': /node_modules/,
    'query': {
      'plugins': ['lodash'],
      'presets': ['es2015']
    }
  }],
  'plugins': [
    new LodashReplacementPlugin,
    new webpack.optimize.OccurenceOrderPlugin,
    new webpack.optimize.UglifyJsPlugin({
      'compressor': {
        'pure_getters': true,
        'unsafe': true,
        'warnings': false
      }
    })
  ]
 }  
};

Opt-in to features by passing an options object:

new LodashReplacementPlugin({
  'collections': true,
  'paths': true
})

The following features are removed by default (biggest savings first):

Feature Description
shorthands Iteratee shorthands for _.property, _.matches, & _.matchesProperty.
collections Support for objects in “Collection” methods like _.each, _.filter, & _.map.
currying Support for _.curry & _.curryRight.
caching Caches using Map & Set for methods like _.cloneDeep, _.isEqual, & _.uniq.
coercions Coercion methods like _.toInteger, _.toNumber, & _.toString.
paths Deep property path support for methods like _.get, _.has, & _.set.
guards Dense array & iteratee call guards for methods like _.every, _.keys, & _.some.
metadata Store metadata to reduce wrapping of bound, curried, & partially applied functions.
(Requires currying)
placeholders Argument placeholder support for methods like _.bind, _.curry, & _.partial.
(Requires currying)

About

Smaller modular Lodash builds.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%