Skip to content

Commit

Permalink
Consolidated webpack configs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikras committed Aug 23, 2016
1 parent 58fcf25 commit a52af30
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": ["es2015-webpack", "react", "stage-2"],
"presets": ["es2015", "react", "stage-2"],
"env": {
"development": {
"plugins": ["lodash", "transform-es2015-modules-commonjs"]
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"build": "npm run build:lib && npm run build:es && npm run build:umd && npm run build:umd:min",
"build:lib": "babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build:umd": "webpack src/index.js dist/redux-form.js --config webpack.config.development.js",
"build:umd:min": "webpack src/index.js dist/redux-form.min.js --config webpack.config.production.js",
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/redux-form.js",
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/redux-form.min.js",
"clean": "rimraf dist lib",
"lint": "eslint src",
"example:simple": "node examples/simple/server.js",
Expand Down Expand Up @@ -59,9 +59,7 @@
"babel-plugin-syntax-async-functions": "^6.5.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.6.5",
"babel-polyfill": "^6.7.4",
"babel-preset-es2015": "6.9.0",
"babel-preset-es2015-webpack": "^6.4.1",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-2": "^6.1.18",
"babel-register": "^6.3.13",
Expand All @@ -75,18 +73,18 @@
"expect-predicate": "^1.0.0",
"flux-standard-action": "^0.6.1",
"jsdom": "^9.1.0",
"lodash-webpack-plugin": "^0.9.0",
"lodash-webpack-plugin": "^0.10.0",
"mocha": "^3.0.2",
"nyc": "^8.1.0",
"react": "^15.2.0",
"react-addons-test-utils": "^15.2.0",
"react-dom": "^15.2.0",
"react": "^15.3.1",
"react-addons-test-utils": "^15.3.1",
"react-dom": "^15.3.1",
"react-redux": "^4.4.1",
"redux": "^3.3.1",
"redux-immutablejs": "0.0.8",
"rifraf": "^2.0.2",
"rimraf": "^2.5.1",
"webpack": "^1.12.13"
"webpack": "^1.13.2"
},
"peerDependencies": {
"react": "^15.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require('babel-polyfill')
import { jsdom } from 'jsdom'

global.document = jsdom('<!doctype html><html><body></body></html>')
Expand Down
17 changes: 0 additions & 17 deletions webpack.config.development.js

This file was deleted.

31 changes: 27 additions & 4 deletions webpack.config.base.js → webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict'
var webpack = require('webpack')
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin')

var env = process.env.NODE_ENV

var reactExternal = {
root: 'React',
Expand All @@ -22,7 +25,7 @@ var reactReduxExternal = {
amd: 'react-redux'
}

module.exports = {
var config = {
externals: {
'react': reactExternal,
'redux': reduxExternal,
Expand All @@ -37,7 +40,27 @@ module.exports = {
library: 'ReduxForm',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
plugins: [
new LodashModuleReplacementPlugin,
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env)
})
]
}

if (env === 'production') {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false
}
})
)
config.plugins.push(new webpack.optimize.DedupePlugin())
}

module.exports = config
23 changes: 0 additions & 23 deletions webpack.config.production.js

This file was deleted.

0 comments on commit a52af30

Please sign in to comment.