'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('react-hot-loader/patch');
			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'),
		inline: true,
		hot: true,
		stats: {
			colors: true,
			exclude: ['node_modules']
		},
		before: 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;
