You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
858 B

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. // const { defineConfig } = require('@vue/cli-service')
  2. // module.exports = defineConfig({
  3. // transpileDependencies: true
  4. // })
  5. const { defineConfig } = require('@vue/cli-service')
  6. module.exports = defineConfig({
  7. devServer: {
  8. proxy: {
  9. // 代理所有以 /api 开头的请求
  10. '/api': {
  11. target: 'http://192.168.40.48:8081', // 你的后端地址
  12. changeOrigin: true, // 允许跨域
  13. pathRewrite: {
  14. '^/api': '' // 重写路径,去掉 /api 前缀
  15. },
  16. secure: false, // 如果是https接口,需要配置这个参数
  17. logLevel: 'debug' // 查看代理日志
  18. },
  19. // 可以配置多个代理
  20. '/upload': {
  21. target: 'http://localhost:3000',
  22. changeOrigin: true
  23. }
  24. },
  25. // 允许外部访问
  26. host: '0.0.0.0',
  27. port: 8080
  28. }
  29. })