/**
 * author
 * 2018-11-5
 * webpack 相关配置
 */

const path = require('path');
const resolve = (dir) => path.join(__dirname, dir);
const ds_overlay = { warnings: true, errors: true };
const ds_proxy = {
	'/': {
		ws: false,
		target: 'https://dev.test.proginn.com/',
		changeOrigin: true
		// pathRewrite: {
		//   '/api/dispatch': '/dispatch'
		// }
	}
};

module.exports = {
	publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
	chainWebpack: (config) => {
		config.entry.vender = [ 'echarts', 'vue', 'vuex', 'vue-router', 'element-ui' ];
		config.resolve.alias
			.set('settings', resolve('./store/modules/settings'))
			.set('static', resolve('./static'))
			.set('styles', resolve('./styles'))
			.set('utils', resolve('./utils'));

		config.devServer
			.set('historyApiFallback', false)
			.set('noInfo', true)
			.set('open', true)
			.set('quiet', true)
			.set('overlay', ds_overlay)
			.set('proxy', ds_proxy)
			.set('disableHostCheck', true);
	}
};
