Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Bundle contains many lodash functions #236

Open
krystian50 opened this issue Apr 16, 2020 · 5 comments
Open

Bundle contains many lodash functions #236

krystian50 opened this issue Apr 16, 2020 · 5 comments

Comments

@krystian50
Copy link

krystian50 commented Apr 16, 2020

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:
Screenshot 2020-04-16 at 12 39 27

With plugin:
Screenshot 2020-04-16 at 12 39 56

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");

@hingermayank
Copy link

@krystian50 hi, any luck?

Happening the same for me. I just used one function but the bundle had too many functions.

Screenshot 2020-04-23 at 4 15 51 AM

@evenfrost
Copy link

Any update?

@evenfrost
Copy link

@jdalton is it still working?

@grzegorzjudas
Copy link

It's still happening. I've prepared a repro repo: grzegorzjudas/babel-lodash-repro.

@0xdevalias
Copy link

Potentially related:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants