gulp解决跨域的配置文件问题
废话不多说,直接上代码
//引入插件 var gulp = require('gulp'); // var Proxy = require('gulp-connect-proxy'); var connect = require('gulp-connect'); var proxy = require('http-proxy-middleware'); //使用connect启动一个Web服务器 gulp.task('connect', function () { connect.server({ root: './', livereload: true, port: 8010, middleware: function (connect, opt) { return [ proxy('/fs', { target: 'http://172.16.2.52:8080', changeOrigin:true }), proxy('/product', { target: 'http://172.16.1.60:8080', changeOrigin:true }), proxy('/bpauth', { target: 'http://192.168.24.77:8080', changeOrigin:true }) ] } }); }); gulp.task('watch', function () { gulp.watch(['./*.html'], ['html']); }); gulp.task('html', function () { gulp.src('./*.html') .pipe(connect.reload()); }); //运行Gulp时,默认的Task gulp.task('default', ['connect', 'watch']);
相关推荐
星辰的笔记 2020-07-04
liangjielaoshi 2020-06-11
zhongweinan 2020-06-10
jiangfulai 2020-04-18
UndefineOrNull 2020-02-29
我有一只小松鼠 2020-02-29
UndefineOrNull 2020-03-01
hlihaihong 2020-02-18
UndefineOrNull 2020-02-12
yinuoqingqin 2020-01-13
星辰的笔记 2020-01-13
UndefineOrNull 2020-01-13
hlihaihong 2020-01-13
kaosini 2020-01-12
hlihaihong 2020-01-12
kaosini 2020-01-12
HSdiana 2019-12-25