Adding prod and dev webpack configs

This commit is contained in:
Jeff Avallone 2018-02-10 16:05:25 -05:00
parent d78f4efd16
commit 97a61dc0f3
5 changed files with 62 additions and 8 deletions

View File

@ -10,10 +10,10 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "webpack-dev-server",
"start": "webpack-dev-server --config webpack.dev.js",
"start:prod": "run-s build start:http-server",
"start:http-server": "http-server ./build",
"build": "webpack"
"build": "webpack --config webpack.prod.js"
},
"dependencies": {
"autoprefixer": "^7.2.5",
@ -25,8 +25,10 @@
"postcss-loader": "^2.1.0",
"precss": "^3.1.0",
"style-loader": "^0.20.1",
"uglifyjs-webpack-plugin": "^1.1.8",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack-dev-server": "^2.11.1",
"webpack-merge": "^4.1.1"
},
"devDependencies": {
"http-server": "^0.11.1",

9
webpack.dev.js Normal file
View File

@ -0,0 +1,9 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = merge(common, {
devtool: 'cheap-module-source-map',
devServer: {
contentBase: './build'
}
});

10
webpack.prod.js Normal file
View File

@ -0,0 +1,10 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = merge(common, {
devtool: 'source-map',
plugins: [
new UglifyJSPlugin()
]
});

View File

@ -1503,7 +1503,7 @@ entities@~1.1.1:
version "1.1.1"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0"
errno@^0.1.3:
errno@^0.1.3, errno@^0.1.4:
version "0.1.6"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/errno/-/errno-0.1.6.tgz#c386ce8a6283f14fc09563b71560908c9bf53026"
dependencies:
@ -3080,7 +3080,7 @@ lodash@3.x, lodash@^3.2.0:
version "3.10.1"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3:
lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4:
version "4.17.5"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
@ -5005,7 +5005,7 @@ schema-utils@^0.3.0:
dependencies:
ajv "^5.0.0"
schema-utils@^0.4.0, schema-utils@^0.4.3:
schema-utils@^0.4.0, schema-utils@^0.4.2, schema-utils@^0.4.3:
version "0.4.3"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/schema-utils/-/schema-utils-0.4.3.tgz#e2a594d3395834d5e15da22b48be13517859458e"
dependencies:
@ -5658,6 +5658,13 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
uglify-es@^3.3.4:
version "3.3.10"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/uglify-es/-/uglify-es-3.3.10.tgz#8b0b7992cebe20edc26de1bf325cef797b8f3fa5"
dependencies:
commander "~2.14.1"
source-map "~0.6.1"
uglify-js@3.3.x:
version "3.3.10"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/uglify-js/-/uglify-js-3.3.10.tgz#8e47821d4cf28e14c1826a0078ba0825ed094da8"
@ -5695,6 +5702,19 @@ uglifyjs-webpack-plugin@^0.4.6:
uglify-js "^2.8.29"
webpack-sources "^1.0.1"
uglifyjs-webpack-plugin@^1.1.8:
version "1.1.8"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.8.tgz#1302fb9471a7daf3d0a5174da6d65f0f415e75ad"
dependencies:
cacache "^10.0.1"
find-cache-dir "^1.0.0"
schema-utils "^0.4.2"
serialize-javascript "^1.4.0"
source-map "^0.6.1"
uglify-es "^3.3.4"
webpack-sources "^1.1.0"
worker-farm "^1.5.2"
uid-number@^0.0.6:
version "0.0.6"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
@ -5947,7 +5967,13 @@ webpack-dev-server@^2.11.1:
webpack-dev-middleware "1.12.2"
yargs "6.6.0"
webpack-sources@^1.0.1:
webpack-merge@^4.1.1:
version "4.1.1"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/webpack-merge/-/webpack-merge-4.1.1.tgz#f1197a0a973e69c6fbeeb6d658219aa8c0c13555"
dependencies:
lodash "^4.17.4"
webpack-sources@^1.0.1, webpack-sources@^1.1.0:
version "1.1.0"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54"
dependencies:
@ -6052,6 +6078,13 @@ wordwrap@~0.0.2:
version "0.0.3"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
worker-farm@^1.5.2:
version "1.5.2"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/worker-farm/-/worker-farm-1.5.2.tgz#32b312e5dc3d5d45d79ef44acc2587491cd729ae"
dependencies:
errno "^0.1.4"
xtend "^4.0.1"
wrap-ansi@^2.0.0:
version "2.1.0"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
@ -6091,7 +6124,7 @@ xmlbuilder@~9.0.1:
version "9.0.7"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
xtend@^4.0.0, xtend@~4.0.1:
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
version "4.0.1"
resolved "http://nexus.home.bromidic.net:8081/repository/npm-all/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"