Skip to content

Commit 1cba5a4

Browse files
committed
Unify configs and use cross-env
1 parent 0ec547e commit 1cba5a4

File tree

4 files changed

+27
-40
lines changed

4 files changed

+27
-40
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"jsnext:main": "./src/index.js",
77
"scripts": {
88
"build:lib": "babel src --out-dir lib",
9-
"build:umd": "webpack src/index.js dist/react-redux.js --config webpack.config.development.js",
10-
"build:umd:min": "webpack src/index.js dist/react-redux.min.js --config webpack.config.production.js",
9+
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/react-redux.js",
10+
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/react-redux.min.js",
1111
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
1212
"clean": "rimraf lib dist coverage",
1313
"lint": "eslint src test",
@@ -51,6 +51,7 @@
5151
"babel-preset-es2015-loose": "^6.1.4",
5252
"babel-preset-react": "^6.3.13",
5353
"babel-preset-stage-0": "^6.3.13",
54+
"cross-env": "^1.0.7",
5455
"eslint": "^1.7.1",
5556
"eslint-config-rackt": "1.1.0",
5657
"eslint-plugin-react": "^3.6.3",

webpack.config.development.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

webpack.config.base.js renamed to webpack.config.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
var webpack = require('webpack')
4+
var env = process.env.NODE_ENV
45

56
var reactExternal = {
67
root: 'React',
@@ -16,7 +17,7 @@ var reduxExternal = {
1617
amd: 'redux'
1718
}
1819

19-
module.exports = {
20+
var config = {
2021
externals: {
2122
'react': reactExternal,
2223
'redux': reduxExternal
@@ -30,7 +31,26 @@ module.exports = {
3031
library: 'ReactRedux',
3132
libraryTarget: 'umd'
3233
},
33-
resolve: {
34-
extensions: ['', '.js']
35-
}
34+
plugins: [
35+
new webpack.optimize.OccurenceOrderPlugin(),
36+
new webpack.DefinePlugin({
37+
'process.env.NODE_ENV': JSON.stringify(env)
38+
})
39+
]
3640
}
41+
42+
if (env === 'production') {
43+
config.plugins.push(
44+
new webpack.optimize.UglifyJsPlugin({
45+
compressor: {
46+
pure_getters: true,
47+
unsafe: true,
48+
unsafe_comps: true,
49+
screw_ie8: true,
50+
warnings: false
51+
}
52+
})
53+
)
54+
}
55+
56+
module.exports = config

webpack.config.production.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)