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 #611

Merged
merged 1 commit into from Jan 31, 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.

8 changes: 5 additions & 3 deletions webpack.config.base.js
@@ -1,5 +1,7 @@
'use strict';

var webpack = require('webpack');

module.exports = {
module: {
loaders: [
Expand All @@ -10,7 +12,7 @@ module.exports = {
library: 'Redux',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
plugins: [
new webpack.optimize.OccurenceOrderPlugin()
]
};
17 changes: 8 additions & 9 deletions webpack.config.development.js
@@ -1,14 +1,13 @@
'use strict';

var _ = require('lodash');
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');

var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
];

module.exports = config;
module.exports = _.merge({}, baseConfig, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using _.merge here instead of Object.create(baseConfig) because the Object.create route doesn't clone object references so changes to them change the baseConfig properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

plugins: baseConfig.plugins.concat(
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
})
)
});
32 changes: 17 additions & 15 deletions webpack.config.production.js
@@ -1,20 +1,22 @@
'use strict';

var _ = require('lodash');
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');

var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
];

module.exports = config;
module.exports = _.merge({}, baseConfig, {
plugins: baseConfig.plugins.concat(
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Using DefinePlugin for __DEV__ as well as process.env.NODE_ENV removes the use of verifyStateShape in lib/utils/combineReducers as dead code in the production build.

new webpack.optimize.UglifyJsPlugin({
compressor: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Added more uglify options to crunch it more :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good. I was always curious what you referred to in some older tweet about not going all the way with Uglify. :-)

pure_getters: true,
unsafe: true,
unsafe_comps: true,
screw_ie8: true,
warnings: false
}
})
)
});