diff --git a/.gitignore b/.gitignore index c0f0a024..d0a81b97 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules .DS_Store lib coverage +dist \ No newline at end of file diff --git a/package.json b/package.json index 78e6459f..faf06def 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,12 @@ "main": "lib/index.js", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib", + "build:lib": "babel src --out-dir lib", + "build:umd": "webpack src/index.js dist/redux-devtools.js --config webpack.config.development.js", + "build:umd:min": "webpack src/index.js dist/redux-devtools.min.js --config webpack.config.production.js", + "build:umd:react": "webpack src/react/index.js dist/redux-devtools.react.js --config webpack.config.development.js", + "build:umd:react:min": "webpack src/react/index.js dist/redux-devtools.react.min.js --config webpack.config.production.js", + "build": "npm run build:lib && npm run build:umd && npm run build:umd:min && npm run build:umd:react && npm run build:umd:react:min", "lint": "eslint src test examples", "test": "NODE_ENV=test mocha --compilers js:babel/register --recursive", "test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch", diff --git a/webpack.config.base.js b/webpack.config.base.js new file mode 100644 index 00000000..a3e76bee --- /dev/null +++ b/webpack.config.base.js @@ -0,0 +1,45 @@ +'use strict'; + +var webpack = require('webpack'); + +var reactExternal = { + root: 'React', + commonjs2: 'react', + commonjs: 'react', + amd: 'react' +}; + +var reactReduxExternal = { + root: 'ReactRedux', + commonjs2: 'react-redux', + commonjs: 'react-redux', + amd: 'react-redux' +}; + +var reduxExternal = { + root: 'Redux', + commonjs2: 'redux', + commonjs: 'redux', + amd: 'redux' +}; + +module.exports = { + externals: { + 'react': reactExternal, + 'react-native': reactExternal, + 'react-redux': reactReduxExternal, + 'redux': reduxExternal + }, + module: { + loaders: [ + { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ } + ] + }, + output: { + library: 'ReduxDevTools', + libraryTarget: 'umd' + }, + resolve: { + extensions: ['', '.js'] + } +}; \ No newline at end of file diff --git a/webpack.config.development.js b/webpack.config.development.js new file mode 100644 index 00000000..628c3582 --- /dev/null +++ b/webpack.config.development.js @@ -0,0 +1,14 @@ +'use strict'; + +var webpack = require('webpack'); +var baseConfig = require('./webpack.config.base'); + +var config = Object.create(baseConfig); +config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('development') + }) +]; + +module.exports = config; \ No newline at end of file diff --git a/webpack.config.production.js b/webpack.config.production.js new file mode 100644 index 00000000..3213b24f --- /dev/null +++ b/webpack.config.production.js @@ -0,0 +1,20 @@ +'use strict'; + +var webpack = require('webpack'); +var baseConfig = require('./webpack.config.base'); + +var config = Object.create(baseConfig); +config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production') + }), + new webpack.optimize.UglifyJsPlugin({ + compressor: { + screw_ie8: true, + warnings: false + } + }) +]; + +module.exports = config; \ No newline at end of file