Skip to content

Commit

Permalink
chore(build): create seperate builds for dev and dist (codymikol#161)
Browse files Browse the repository at this point in the history
Seperate builds out, dist minifies and remove comments where as dev is pretty raw
  • Loading branch information
MikaAK authored and joshwiens committed Aug 5, 2016
1 parent d0c1316 commit e7d16e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"test.integration": "npm run build && karma start --single-run",
"travis": "npm run test.unit && npm run test.integration",
"generate.changelog": "node scripts/release/generate-changelog.js",
"build": "webpack"
"build:dev": "webpack",
"build:dist": "NODE_ENV='production' webpack"
},
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import path from 'path'
import {optimize} from 'webpack'
import {name, dependencies, devDependencies} from './package.json'

const {UglifyJsPlugin} = optimize

const rootPath = (nPath) => path.resolve(__dirname, nPath)
const BUILD_PATH = './dist'
const NODE_MODULES = rootPath('node_modules')
const IS_BUILD = process.env.NODE_ENV === 'production'

const CONFIG = {
entry: './src/karma-webpack.js',
Expand Down Expand Up @@ -32,4 +36,12 @@ const CONFIG = {
.concat(Object.keys(devDependencies))
}

if (IS_BUILD)
CONFIG.plugins = [
new UglifyJsPlugin({
comments: false,
sourceMap: false
})
]

export default CONFIG

0 comments on commit e7d16e3

Please sign in to comment.