vue.config.js 642 B

12345678910111213141516171819
  1. const { defineConfig } = require('@vue/cli-service');
  2. module.exports = defineConfig({
  3. transpileDependencies: true,
  4. lintOnSave: false,
  5. // 配置正向代理
  6. devServer: {
  7. proxy: {
  8. '/api/v1': {
  9. // 代理请求的真正服务器地址,
  10. // 即 当你向 '/api/v1' 地址发起请求时,真正请求的地址为
  11. // 'http://localhost:3000/api/v1'
  12. // 譬如:登录接口 http://localhost:3000/api/v1/user/login
  13. // 由于配置代理 因此 发起请求时 直接写'/api/v1/user/login
  14. target: 'http://localhost:3000',
  15. changeOrigin: true,
  16. },
  17. },
  18. },
  19. });