webpack-externalize-lodash

1.0.1 • Public • Published

Build Status

This module exports a simple utility function that externalizes lodash from your bundle.

npm install webpack-externalize-lodash


Why this is needed

There are many ways to use lodash:

import { get } from 'lodash'
import { get } from 'lodash-es'
import get from 'lodash/get'
import get from 'lodash-es/get'
import get from 'lodash.get'

As your project grows and depends on different libraries, some of them will use different lodash helpers, imported in a different way. As a result your bundle will sometimes include lodash multiple times, even if you have it defined it as external in webpack lodash: "_" (this covers only one case).

So the only way to prevent it from being included into your bundle is use externals function which handles all cases. That's exactly what this package does.

Usage

Inside your webpack config

externals: [
  {...}// your config,
  require('webpack-externalize-lodash)
]

Package Sidebar

Install

npm i webpack-externalize-lodash

Weekly Downloads

299

Version

1.0.1

License

MIT

Unpacked Size

9.89 kB

Total Files

3

Last publish

Collaborators

  • vybu