contentful / contentful.js

JavaScript library for Contentful's Delivery API (node & browser)
https://contentful.github.io/contentful.js
MIT License
1.19k stars 198 forks source link

Full lodash dependency when consumed as a module #408

Closed JackCA closed 3 years ago

JackCA commented 4 years ago

Expected Behavior

When consuming this library as a module, the entire lodash library is included.

Actual Behavior

The entire library is included because the module build does not get the advantages provided by the webpack/babel plugins in the non-module version.

I don't think you should expect end-users to subsequently use webpack/babel on their downstream package because they might not be using these libraries, and/or they're never going to notice that this dependency is being included.

Possible Solution

You could:

  1. Switch to lodash-es and remove all of the code related to the babel/webpack plugins.
  2. or use the individual packages

Steps to Reproduce

  1. Create an ecmascript project that consumes contentful
  2. Add webpack (in order to use webpack bundle analyzer)
  3. analyze the bundle
  4. Notice that lodash is included

Context

Added ~ 24KB lodash library to payload

Environment

Application:

devdpontes commented 4 years ago

It's only being used for cloneDeep.

ghost commented 3 years ago

:tada: This issue has been resolved in version 7.15.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: