//开发环境配置
const HtmlWebpackPlugin = require('html-webpack-plugin');
// vue-loader15.*之后的版本都必须要加上这个,否则会报错
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin'); //复制文件

module.exports = {
	mode: 'development',
	output: {
		filename: 'bundle.js'
	},
	devtool: 'source-map',
	plugins: [
		new CopyWebpackPlugin([{
			from: "src/public",
			to: "public"
		}]),
		new HtmlWebpackPlugin({
			template: 'index.html'
		}),
		new VueLoaderPlugin()
	],
	devServer: {
		index: "index.html", //默认文件名
		hot: true, //热更新
		host: "0.0.0.0",
		compress: true,
		port: 9000,
		disableHostCheck: true,
		proxy: {
			'/screen': {
				// target: "http://127.0.0.1:9008",
				target: "https://dzfarmingmapscream.dev.dazesoft.cn",
				pathRewrite: {
					"^/screen": ""
				},
				changeOrigin: true,
			},
			"/defdata": {
				target: "http://127.0.0.1:3002",
				// target: "http://lldp2.z.gyhywa.com:9527",
				pathRewrite: {
					"^/defdata": ""
				},
				changeOrigin: true
			},
			"/htdata": {
				// target: "http://lyfbht.hw.hongweisoft.com",
				target:"http://172.16.90.199:8104",
				// target: "http://47.111.224.169:8310",
				// target: 'http://58.16.127.62:2035',
				
				// pathRewrite: {
				// 	"^/htdata": ""
				// },
				changeOrigin: true
			},
			"/amapData": {
				target: "https://restapi.amap.com",
				// target: 'http://58.16.127.62:2035',
				pathRewrite: {
					"^/amapData": ""
				},
				changeOrigin: true
			},
			'/product': {
				target: 'http://ghost.nat300.top',
				pathRewrite: {
					'^/product': ''
				},
				changeOrigin: true
			},
			'/forest-admin': {
				target: 'http://lyfbht.hw.hongweisoft.com',
				changeOrigin: true
			}
		}
	}
}
