vue.config.js 739 B

1234567891011121314151617181920212223
  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. '/public': {
  18. target: 'http://localhost:3000',
  19. changeOrigin: true,
  20. },
  21. },
  22. },
  23. });