File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 "test-watch" : " karma start" ,
99 "prepare-build" : " npm run lint && rimraf dist/" ,
1010 "prebuild" : " npm run prepare-build" ,
11- "build" : " jsx -x jsx ./src ./dist & jsx ./src ./dist" ,
11+ "build" : " jsx -x jsx ./src ./dist & jsx ./src ./dist && webpack --stats --config webpack.config.umd.prod.js && webpack --stats --config webpack.config.umd.dev.js " ,
1212 "lint" : " eslint src --ext .jsx,.js" ,
1313 "start" : " NODE_ENV=development node devServer.js" ,
1414 "build:example" : " rimraf example/build/ && webpack --stats --config webpack.config.prod.js"
Original file line number Diff line number Diff line change 1+ var path = require ( 'path' ) ;
2+ var webpack = require ( 'webpack' ) ;
3+
4+ var JS_REGEX = / \. j s $ | \. j s x $ | \. e s 6 $ | \. b a b e l $ / ;
5+
6+ module . exports = {
7+ entry : [
8+ './src/NotificationSystem.jsx'
9+ ] ,
10+ output : {
11+ path : path . join ( __dirname , 'dist' ) ,
12+ filename : 'react-notification-system.js' ,
13+ libraryTarget : 'umd'
14+ } ,
15+ externals : [
16+ {
17+ react : {
18+ root : 'React' ,
19+ commonjs2 : 'react' ,
20+ commonjs : 'react' ,
21+ amd : 'react'
22+ }
23+ } ,
24+ {
25+ 'react-dom' : {
26+ root : 'ReactDOM' ,
27+ commonjs2 : 'react-dom' ,
28+ commonjs : 'react-dom' ,
29+ amd : 'react-dom'
30+ }
31+ }
32+ ] ,
33+ plugins : [
34+ new webpack . NoErrorsPlugin ( )
35+ ] ,
36+ resolve : {
37+ extensions : [ '' , '.js' , '.jsx' ] ,
38+ modulesDirectories : [ 'node_modules' , 'src' ]
39+ } ,
40+ module : {
41+ loaders : [
42+ {
43+ test : JS_REGEX ,
44+ include : [
45+ path . resolve ( __dirname , 'src' ) ,
46+ path . resolve ( __dirname , 'example/src' )
47+ ] ,
48+ loader : 'babel?presets=airbnb'
49+ }
50+ ]
51+ }
52+ } ;
Original file line number Diff line number Diff line change 1+ var path = require ( 'path' ) ;
2+ var webpack = require ( 'webpack' ) ;
3+
4+ var JS_REGEX = / \. j s $ | \. j s x $ | \. e s 6 $ | \. b a b e l $ / ;
5+
6+ module . exports = {
7+ entry : [
8+ './src/NotificationSystem.jsx'
9+ ] ,
10+ output : {
11+ path : path . join ( __dirname , 'dist' ) ,
12+ filename : 'react-notification-system.min.js' ,
13+ libraryTarget : 'umd'
14+ } ,
15+ devtool : 'source-map' ,
16+ externals : [
17+ {
18+ react : {
19+ root : 'React' ,
20+ commonjs2 : 'react' ,
21+ commonjs : 'react' ,
22+ amd : 'react'
23+ }
24+ } ,
25+ {
26+ 'react-dom' : {
27+ root : 'ReactDOM' ,
28+ commonjs2 : 'react-dom' ,
29+ commonjs : 'react-dom' ,
30+ amd : 'react-dom'
31+ }
32+ }
33+ ] ,
34+ plugins : [
35+ // set env
36+ new webpack . DefinePlugin ( {
37+ 'process.env' : {
38+ BROWSER : JSON . stringify ( true ) ,
39+ NODE_ENV : JSON . stringify ( 'production' )
40+ }
41+ } ) ,
42+
43+ // optimizations
44+ new webpack . optimize . DedupePlugin ( ) ,
45+ new webpack . optimize . OccurenceOrderPlugin ( ) ,
46+ new webpack . optimize . UglifyJsPlugin ( {
47+ compress : {
48+ warnings : false ,
49+ screw_ie8 : true ,
50+ sequences : true ,
51+ dead_code : true ,
52+ drop_debugger : true ,
53+ comparisons : true ,
54+ conditionals : true ,
55+ evaluate : true ,
56+ booleans : true ,
57+ loops : true ,
58+ unused : true ,
59+ hoist_funs : true ,
60+ if_return : true ,
61+ join_vars : true ,
62+ cascade : true ,
63+ drop_console : false
64+ } ,
65+ output : {
66+ comments : false
67+ }
68+ } )
69+ ] ,
70+ resolve : {
71+ extensions : [ '' , '.js' , '.jsx' ] ,
72+ modulesDirectories : [ 'node_modules' , 'src' ]
73+ } ,
74+ module : {
75+ loaders : [
76+ {
77+ test : JS_REGEX ,
78+ include : [
79+ path . resolve ( __dirname , 'src' ) ,
80+ path . resolve ( __dirname , 'example/src' )
81+ ] ,
82+ loader : 'babel?presets=airbnb'
83+ }
84+ ]
85+ }
86+ } ;
You can’t perform that action at this time.
0 commit comments