File tree Expand file tree Collapse file tree 3 files changed +54
-2
lines changed Expand file tree Collapse file tree 3 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ node_modules
2
2
coverage
3
3
* .log
4
4
lib
5
+ dist
Original file line number Diff line number Diff line change 12
12
"prepublish" : " npm run test && rimraf lib && npm run build" ,
13
13
"test" : " mocha --compilers js:babel-core/register --reporter spec test/*.js" ,
14
14
"posttest" : " npm run lint" ,
15
- "lint" : " eslint src test"
15
+ "lint" : " eslint src test" ,
16
+ "build" : " npm run build:commonjs && npm run build:umd && npm run build:umd:min" ,
17
+ "build:commonjs" : " babel src --out-dir lib" ,
18
+ "build:umd" : " NODE_ENV=development webpack" ,
19
+ "build:umd:min" : " NODE_ENV=production webpack"
16
20
},
17
21
"repository" : {
18
22
"type" : " git" ,
33
37
"babel-cli" : " ^6.2.0" ,
34
38
"babel-core" : " ^6.2.1" ,
35
39
"babel-eslint" : " ^5.0.0-beta4" ,
40
+ "babel-loader" : " ^6.2.4" ,
36
41
"babel-plugin-add-module-exports" : " ^0.1.1" ,
37
42
"babel-preset-es2015" : " ^6.1.18" ,
38
43
"babel-preset-stage-0" : " ^6.1.18" ,
41
46
"eslint-config-airbnb" : " 1.0.2" ,
42
47
"eslint-plugin-react" : " ^4.1.0" ,
43
48
"mocha" : " ^2.2.5" ,
44
- "rimraf" : " ^2.4.3"
49
+ "rimraf" : " ^2.4.3" ,
50
+ "webpack" : " ^1.12.14"
45
51
}
46
52
}
Original file line number Diff line number Diff line change
1
+ import webpack from 'webpack' ;
2
+ import path from 'path' ;
3
+
4
+ const { NODE_ENV , TARGET } = process . env ;
5
+
6
+ const plugins = [
7
+ new webpack . optimize . OccurenceOrderPlugin ( ) ,
8
+ new webpack . DefinePlugin ( {
9
+ 'process.env.NODE_ENV' : JSON . stringify ( NODE_ENV )
10
+ } ) ,
11
+ ] ;
12
+
13
+ const filename = `redux-thunk${ NODE_ENV === 'production' ? '.min' : '' } .js` ;
14
+
15
+ NODE_ENV === 'production' && plugins . push (
16
+ new webpack . optimize . UglifyJsPlugin ( {
17
+ compressor : {
18
+ pure_getters : true ,
19
+ unsafe : true ,
20
+ unsafe_comps : true ,
21
+ screw_ie8 : true ,
22
+ warnings : false
23
+ }
24
+ } )
25
+ ) ;
26
+
27
+ export default {
28
+ module : {
29
+ loaders : [
30
+ { test : / \. j s $ / , loaders : [ 'babel-loader' ] , exclude : / n o d e _ m o d u l e s / }
31
+ ]
32
+ } ,
33
+
34
+ entry : [
35
+ './src/index' ,
36
+ ] ,
37
+
38
+ output : {
39
+ path : path . join ( __dirname , 'dist' ) ,
40
+ filename,
41
+ libraryTarget : 'umd' ,
42
+ } ,
43
+
44
+ plugins,
45
+ } ;
You can’t perform that action at this time.
0 commit comments