const Webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./webpack.config');
const compiler = Webpack(webpackConfig);
const { PORT } = process.env;
const devServerOptions = Object.assign({}, webpackConfig.devServer, {
	stats: {
		stats: 'errors-only',
		colors: true
	},
	historyApiFallback: {
		index: 'index.html'
	},
	staticOptions: {
		redirect: false
	}
});
const server = new WebpackDevServer(compiler, devServerOptions);
server.listen(parseInt(PORT || '5000'), '0.0.0.0', () => {
	console.log('Starting server on http://localhost:5000');
});
