Added UMD build

This commit is contained in:
Tomer Ohana 2015-10-03 19:54:03 +03:00
parent bd75e81719
commit cc7037addb
5 changed files with 86 additions and 1 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ node_modules
.DS_Store .DS_Store
lib lib
coverage coverage
dist

View File

@ -5,7 +5,12 @@
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
"clean": "rimraf lib", "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", "lint": "eslint src test examples",
"test": "NODE_ENV=test mocha --compilers js:babel/register --recursive", "test": "NODE_ENV=test mocha --compilers js:babel/register --recursive",
"test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch", "test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch",

45
webpack.config.base.js Normal file
View File

@ -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']
}
};

View File

@ -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;

View File

@ -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;