Skip to content

Commit dabbb7b

Browse files
author
Michael Kidder
committed
use cross-env for webpack
1 parent d98c3f0 commit dabbb7b

5 files changed

+40
-52
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"test:examples": "babel-node examples/testAll.js",
1919
"check": "npm run lint && npm run test",
2020
"build:lib": "babel src --out-dir lib",
21-
"build:umd": "webpack src/index.js dist/redux.js --config webpack.config.development.js",
22-
"build:umd:min": "webpack src/index.js dist/redux.min.js --config webpack.config.production.js",
21+
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/redux.js",
22+
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/redux.min.js",
2323
"build:examples": "babel-node examples/buildAll.js",
2424
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
2525
"preversion": "npm run clean && npm run check",
@@ -66,6 +66,7 @@
6666
"babel-core": "^5.6.18",
6767
"babel-eslint": "^4.1.0",
6868
"babel-loader": "^5.1.4",
69+
"cross-env": "^1.0.7",
6970
"eslint": "^1.10.3",
7071
"eslint-config-rackt": "^1.1.1",
7172
"eslint-plugin-react": "^3.16.1",

webpack.config.base.js

-16
This file was deleted.

webpack.config.development.js

-14
This file was deleted.

webpack.config.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
var webpack = require('webpack');
3+
4+
var nodeEnv = process.env.NODE_ENV;
5+
var config = {
6+
module: {
7+
loaders: [
8+
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
9+
]
10+
},
11+
output: {
12+
library: 'Redux',
13+
libraryTarget: 'umd'
14+
},
15+
resolve: {
16+
extensions: ['', '.js']
17+
},
18+
plugins : [
19+
new webpack.optimize.OccurenceOrderPlugin(),
20+
new webpack.DefinePlugin({
21+
'process.env.NODE_ENV': JSON.stringify(nodeEnv)
22+
})
23+
]
24+
};
25+
26+
if (nodeEnv == 'production') {
27+
config.plugins.push(
28+
new webpack.optimize.UglifyJsPlugin({
29+
compressor: {
30+
screw_ie8: true,
31+
warnings: false
32+
}
33+
})
34+
)
35+
}
36+
37+
module.exports = config;

webpack.config.production.js

-20
This file was deleted.

0 commit comments

Comments
 (0)