Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit ad0d41d

Browse files
Dattayatimdorr
authored andcommitted
Add umd build; fixes #354 (#362)
1 parent 5075f34 commit ad0d41d

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lib
2+
dist
23
node_modules
34
coverage
45
*.log

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
],
1717
"license": "MIT",
1818
"scripts": {
19-
"build": "mkdir -p lib && babel ./src -d lib",
19+
"build": "npm run build:commonjs & npm run build:umd & npm run build:umd:min",
20+
"build:commonjs": "mkdir -p lib && babel ./src -d lib",
21+
"build:umd": "webpack dist/ReactRouterRedux.js",
22+
"build:umd:min": "NODE_ENV=production webpack dist/ReactRouterRedux.min.js",
2023
"lint": "eslint examples src test",
2124
"test": "npm run lint && npm run test:node && npm run test:browser",
2225
"test:node": "mocha --compilers js:babel-register --recursive ./test/*.spec.js",

webpack.config.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var webpack = require('webpack')
2+
3+
var config = {
4+
entry: './src/index',
5+
module: {
6+
loaders: [
7+
{ test: /\.js$/, loaders: [ 'babel' ], exclude: /node_modules/ }
8+
]
9+
},
10+
output: {
11+
library: 'ReactRouterRedux',
12+
libraryTarget: 'umd'
13+
},
14+
plugins: [
15+
new webpack.optimize.OccurenceOrderPlugin()
16+
]
17+
}
18+
19+
if (process.env.NODE_ENV === 'production') {
20+
config.plugins.push(
21+
new webpack.optimize.UglifyJsPlugin({
22+
compressor: {
23+
warnings: false
24+
}
25+
})
26+
)
27+
}
28+
29+
module.exports = config

0 commit comments

Comments
 (0)