Commit 000180e5 authored by Mike Greiling's avatar Mike Greiling

conditionally apply webpack-dev-server config

parent 61ca496b
...@@ -5,6 +5,7 @@ var webpack = require('webpack'); ...@@ -5,6 +5,7 @@ var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin'); var StatsPlugin = require('stats-webpack-plugin');
var IS_PRODUCTION = process.env.NODE_ENV === 'production'; var IS_PRODUCTION = process.env.NODE_ENV === 'production';
var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') !== -1;
var ROOT_PATH = path.resolve(__dirname, '..'); var ROOT_PATH = path.resolve(__dirname, '..');
// must match config.webpack.dev_server.port // must match config.webpack.dev_server.port
...@@ -66,7 +67,9 @@ if (IS_PRODUCTION) { ...@@ -66,7 +67,9 @@ if (IS_PRODUCTION) {
new webpack.optimize.DedupePlugin(), new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin() new webpack.optimize.OccurrenceOrderPlugin()
); );
} else { }
if (IS_DEV_SERVER) {
config.devServer = { config.devServer = {
port: DEV_SERVER_PORT, port: DEV_SERVER_PORT,
headers: { 'Access-Control-Allow-Origin': '*' } headers: { 'Access-Control-Allow-Origin': '*' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment