babel-plugin-lodash
babel-plugin-lodash copied to clipboard
Bundle contains many lodash functions
Why the build size is so large?
Working example: https://github.com/krystian50/babel-plugin-lodash-issue The only lodash related code is:
import './index.html';
import _fp from 'lodash/fp';
const value =
_fp.map(el => el * 3)
([1, 2])
console.log(value);
Plugin is added through .babelrc
Without babel-plugin-lodash build looks like:

With plugin:

Basically there is many functions, but I only used map. I checked build code and there is import lines:
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var lodash_fp_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/fp/map */ "./node_modules/lodash/fp/map.js");
/* harmony import */ var lodash_fp_map__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_fp_map__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.html */ "./src/index.html");
@krystian50 hi, any luck?
Happening the same for me. I just used one function but the bundle had too many functions.
Any update?
@jdalton is it still working?
It's still happening. I've prepared a repro repo: grzegorzjudas/babel-lodash-repro.
Potentially related:
- https://github.com/lodash/babel-plugin-lodash/issues/243