Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lodash v4. #1339

Merged
merged 1 commit into from Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -59,6 +59,7 @@
},
"homepage": "http://rackt.github.io/redux",
"dependencies": {
"lodash": "^4.1.0",
"loose-envify": "^1.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/combineReducers.js
@@ -1,5 +1,5 @@
import { ActionTypes } from './createStore'
import isPlainObject from './utils/isPlainObject'
import isPlainObject from 'lodash/isPlainObject'
import warning from './utils/warning'

function getUndefinedStateErrorMessage(key, action) {
Expand Down
2 changes: 1 addition & 1 deletion src/createStore.js
@@ -1,4 +1,4 @@
import isPlainObject from './utils/isPlainObject'
import isPlainObject from 'lodash/isPlainObject'

/**
* These are private action types reserved by Redux.
Expand Down
24 changes: 0 additions & 24 deletions src/utils/isPlainObject.js

This file was deleted.

22 changes: 0 additions & 22 deletions test/utils/isPlainObject.spec.js

This file was deleted.

10 changes: 9 additions & 1 deletion webpack.config.js
Expand Up @@ -14,10 +14,18 @@ var config = {
libraryTarget: 'umd'
},
plugins : [
{
apply: function apply(compiler) {
compiler.parser.plugin('expression global', function expressionGlobalPlugin() {
this.state.module.addVariable('global', "(function() { return this; }()) || Function('return this')()")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious how much going to great lengths like Lodash does is buying us. Should we settle for this, or should we do a more sophisticated check like #611 (comment)?

Also, are we breaking anyone with this? Are there environments where Object.getPrototypeOf (as we had before) would “just work” but Function('return this')()" would fail? I'm thinking stuff like Firefox extensions etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You stated that double compiling is an edge case. One that webpack clearly doesn't support. This is going above and beyond to support double compiling in the primary browser case. If they are double compiling and using their code in extensions then yes it could be an issue.

Lodash's UMD is erm... robust because folks do some crazy interesting stuff and we have to support it. I don't know any other project who has as robust a UMD as lodash. I think your UMD is fine.

return false
});
}
},
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env)
})
})
]
};

Expand Down