diff --git a/.gitignore b/.gitignore index b2cc0b3..1da2b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ lib +dist node_modules coverage *.log diff --git a/package.json b/package.json index 6ac133e..fc41e4a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,10 @@ ], "license": "MIT", "scripts": { - "build": "mkdir -p lib && babel ./src -d lib", + "build": "npm run build:commonjs & npm run build:umd & npm run build:umd:min", + "build:commonjs": "mkdir -p lib && babel ./src -d lib", + "build:umd": "webpack dist/ReactRouterRedux.js", + "build:umd:min": "NODE_ENV=production webpack dist/ReactRouterRedux.min.js", "lint": "eslint examples src test", "test": "npm run lint && npm run test:node && npm run test:browser", "test:node": "mocha --compilers js:babel-register --recursive ./test/*.spec.js", diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..5ff9073 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,29 @@ +var webpack = require('webpack') + +var config = { + entry: './src/index', + module: { + loaders: [ + { test: /\.js$/, loaders: [ 'babel' ], exclude: /node_modules/ } + ] + }, + output: { + library: 'ReactRouterRedux', + libraryTarget: 'umd' + }, + plugins: [ + new webpack.optimize.OccurenceOrderPlugin() + ] +} + +if (process.env.NODE_ENV === 'production') { + config.plugins.push( + new webpack.optimize.UglifyJsPlugin({ + compressor: { + warnings: false + } + }) + ) +} + +module.exports = config