Vue 中在开发环境dev上实现跨域请求
2019-06-11 14:28
1436 查看
I Your application is running here: http://127.0.0.1:8080
[HPM] Error occurred while trying to proxy request /content/showall from 127.0.0.1:8080 to http://localhost:8085/ (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Vue 访问path是127.0.0.1:8080
后台接口的path是http://localhost:8085/
'use strict' // Template version: 1.3.1 // see http://vuejs-templates.github.io/webpack for documentation. const path = require('path') module.exports = { dev: { assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: { '/api':{ target:'http://127.0.0.1:8085/', changeOrigin:true, pathRewrite:{ '^/api':'' } } }, host: '127.0.0.1', // can be overwritten by process.env.HOST port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined autoOpenBrowser: false, errorOverlay: true, notifyOnErrors: true, poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- devtool: 'cheap-module-eval-source-map', cacheBusting: true, cssSourceMap: true }, build: { // Template for index.html index: path.resolve(__dirname, '../dist/index.html'), // Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', /** * Source Maps */ productionSourceMap: true, // https://webpack.js.org/configuration/devtool/#production devtool: '#source-map', // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report } }
相关文章推荐
- vue-cli开发环境实现跨域请求的方法
- vue-cli开发环境实现跨域请求
- vue-cli项目开发/生产环境代理实现跨域请求+webpack配置开发/生产环境的接口地址
- 【笔记】vue-cli 开发环境中跨域连接后台api(vue-resource 跨域post 请求)
- vue项目开发环境对跨域进行了配置,测试环境请求接口出问题
- [Phonegap+Sencha Touch] 移动开发49 js跨域请求的实现方法
- Vue-cli proxyTable 解决开发环境的跨域问题
- webpack-dev-server+vue构建开发环境(一)
- vue利用axios处理开发环境和生成环境的跨域问题
- Vue-cli proxyTable 解决开发环境的跨域问题
- vue 本地环境跨域请求proxyTable
- VUE开发请求本地数据的配置,旧版本dev-server.js,新版本webpack.dev.conf.js
- vue解决开发环境和生产环境的跨域
- 微信会员注册开发【带源码】:网页授权,得到code后在当前页面获取openid,js+php实现跨域请求
- Vue-cli proxyTable 解决开发环境的跨域问题详解
- vue项目开发之proxyTable 解决开发环境的跨域
- 转:Vue-cli proxyTable 解决开发环境的跨域问题
- vue.js使用axios实现跨域请求
- (二)vue开发 - 使用vue-resource实现网络请求
- Vue 2.x 如何利用proxyTable实现跨域请求(反向代理)