Redux: Dendencies Update

Created on 15 Dec 2016  路  8Comments  路  Source: reduxjs/redux

Problem: useless lodash , lodash-es and loose-envify

In redux package.json this packages is included as dependencies and obviously is installed each time.
Those packages are used in examples I think it makes sense to make them as devDependecies.

What do you think?

Also, I have a question. What is the use case of symbol-observable? Is there any doc to find information about that?

Most helpful comment

The entire lodash is depended on, but the only thing it's used for is isPlainObject

node_modules/redux//es/combineReducers.js:import isPlainObject from 'lodash-es/isPlainObject';
node_modules/redux//es/createStore.js:import isPlainObject from 'lodash-es/isPlainObject';
node_modules/redux//lib/combineReducers.js:var _isPlainObject = require('lodash/isPlainObject');
node_modules/redux//lib/createStore.js:var _isPlainObject = require('lodash/isPlainObject');
node_modules/redux//src/combineReducers.js:import isPlainObject from 'lodash/isPlainObject'
node_modules/redux//src/createStore.js:import isPlainObject from 'lodash/isPlainObject'

I would recommend switching to lodash.isplainobject to skip the weight of the full lodash and lodash-es

All 8 comments

loose-envify needs to be a dependency for browserify to work properly. lodash is used in some places in the source, and redux can be built with lodash-es.

The entire lodash is depended on, but the only thing it's used for is isPlainObject

node_modules/redux//es/combineReducers.js:import isPlainObject from 'lodash-es/isPlainObject';
node_modules/redux//es/createStore.js:import isPlainObject from 'lodash-es/isPlainObject';
node_modules/redux//lib/combineReducers.js:var _isPlainObject = require('lodash/isPlainObject');
node_modules/redux//lib/createStore.js:var _isPlainObject = require('lodash/isPlainObject');
node_modules/redux//src/combineReducers.js:import isPlainObject from 'lodash/isPlainObject'
node_modules/redux//src/createStore.js:import isPlainObject from 'lodash/isPlainObject'

I would recommend switching to lodash.isplainobject to skip the weight of the full lodash and lodash-es

@brigand Actually, I can't found any usages loose-envify in src folder except in Error String. Please if you found it add a path to it.

@Munter There's no full lodash. 'lodash-es/isPlainObject' means the same as separate package, but this case won't let to switch in es modules version.

@Mamoru1234 it's used in package.json.

  "browserify": {
    "transform": [
      "loose-envify"
    ]
  },

Browserify reads the package.json and runs any transforms mentioned there on the code in the redux package.

If they're not installed, it won't work.

@brigand But redux is library and you running browserify only during development(you know what kind of dep i mean).

@Mamoru1234 npm install redux doesn't install redux's dev deps, so loose-envify wouldn't be installed, and then browserify wouldn't work correctly. Redux having it as a regular dep is both required and harmless.

Note that installing lodash/lodash-es only incurs a size and install penalty on your local machine. When built, the entirety of that library is not included.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timdorr picture timdorr  路  56Comments

nickknw picture nickknw  路  71Comments

markerikson picture markerikson  路  44Comments

5h1rU picture 5h1rU  路  115Comments

markerikson picture markerikson  路  51Comments