Socket
Socket
Sign inDemoInstall

lodash-webpack-plugin

Package Overview
Dependencies
78
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-webpack-plugin

Smaller modular Lodash builds.


Version published
Maintainers
4
Weekly downloads
118,793
increased by3.77%
Install size
1.36 MB

Weekly downloads

Readme

Source

lodash-webpack-plugin

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

This plugin complements babel-plugin-lodash by shrinking its cherry-picked builds even further!

DISCLAIMER: Using this plugin without enabling the proper feature sets may cause lodash functions to behave in unexpected ways. Methods may appear to work, however they might return incorrect results.

Install

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

Example

demo

Usage

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

module.exports = {
  'module': {
    'rules': [{
      'use': 'babel-loader',
      'test': /\.js$/,
      'exclude': /node_modules/,
      'options': {
        'plugins': ['lodash'],
        'presets': [['env', { 'modules': false, 'targets': { 'node': 4 } }]]
      }
    }]
  },
  'plugins': [
    new LodashModuleReplacementPlugin,
    new webpack.optimize.UglifyJsPlugin
  ]
};

Opt-in to features with an options object:

new LodashModuleReplacementPlugin({
  'collections': true,
  'paths': true
});

Feature Sets

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

FeatureDescription
shorthandsIteratee shorthands for _.property, _.matches, & _.matchesProperty.
cloningSupport “clone” methods & cloning source objects.
curryingSupport “curry” methods.
cachingCaches for methods like _.cloneDeep, _.isEqual, & _.uniq.
collectionsSupport objects in “Collection” methods.
exoticsSupport objects like buffers, maps, sets, symbols, typed arrays, etc.
guardsGuards for host objects, sparse arrays, & other edge cases.
metadataMetadata to reduce wrapping of bound, curried, & partially applied functions.
(requires currying)
deburringSupport deburring letters.
unicodeSupport Unicode symbols.
chainingComponents to support chain sequences.
memoizingSupport _.memoize & memoization.
coercionsSupport for coercing values to integers, numbers, & strings.
flatteningSupport “flatten” methods & flattening rest arguments.
pathsDeep property path support for methods like _.get, _.has, & _.set.
placeholdersArgument placeholder support for “bind”, “curry”, & “partial” methods.
(requires currying)

Keywords

FAQs

Last updated on 19 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc