aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/webpack.config.js
blob: c723a7a86c8abd0ea08c43ecebec8a9ff04b0135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /
'use strict';

const path = require('path');
const webpack = require('webpack');
const proxyServer = require('./proxy-server');

let localDevConfig = {};
try {
	localDevConfig = require('./devConfig');
} catch (e) {}
let devConfig = Object.assign({}, require('./devConfig.defaults'), localDevConfig);
let devPort = process.env.PORT || devConfig.port;

let webpackCommon = require('./webpack.common');

function getEntrySources(sources) {
	for (let i in sources) {
		if (sources.hasOwnProperty(i)) {
			sources[i].push('webpack-dev-server/client?http://localhost:' + devPort);
			sources[i].push('webpack/hot/only-dev-server');
		}
	}
	return sources;
}

let webpackDevConfig = Object.assign({}, webpackCommon, {
	entry: getEntrySources(devConfig.bundles),
	devtool: 'eval-source-map',
	output: {
		path: path.join(__dirname, 'dist'),
		publicPath: `http://localhost:${devPort}/onboarding/`,
		filename: '[name].js'
	},
	devServer: {
		port: devPort,
		historyApiFallback: true,
		publicPath: `http://localhost:${devPort}/onboarding/`,
		contentBase: path.join(__dirname, 'dist'),
		hot: true,
		inline: true,
		stats: {
			colors: true,
			exclude: ['node_modules']
		},
		setup: proxyServer
	},
	plugins: [
		new webpack.DefinePlugin({
			DEV: true,
			DEBUG: true
		}),
		new webpack.HotModuleReplacementPlugin(),
		new webpack.LoaderOptionsPlugin({
			options: {
				eslint: {
					configFile: './.eslintrc',
					emitError: true,
					emitWarning: true
				},
				context: '/'
			}
		})
	]
});

module.exports = webpackDevConfig;