vue.config.js 939 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const {
  2. defineConfig
  3. } = require('@vue/cli-service')
  4. const {
  5. VantResolver
  6. } = require('unplugin-vue-components/resolvers');
  7. const ComponentsPlugin = require('unplugin-vue-components/webpack');
  8. module.exports = defineConfig({
  9. transpileDependencies: true,
  10. configureWebpack: {
  11. plugins: [
  12. ComponentsPlugin({
  13. resolvers: [VantResolver()],
  14. }),
  15. ],
  16. },
  17. devServer: {
  18. // https: true,
  19. port: "8088", //代理端口
  20. open: false, //项目启动时是否自动打开浏览器,我这里设置为false,不打开,true表示打开
  21. headers: {
  22. 'Access-Control-Allow-Origin': '*',
  23. },
  24. proxy: {
  25. // https://cn.vitejs.dev/config/#server-proxy
  26. '/test-api': {
  27. target: 'http://139.9.102.170:20010/',
  28. changeOrigin: true,
  29. rewrite: (p) => p.replace(/^\/test-api/, '')
  30. },
  31. '/prod-api': {
  32. target: 'http://175.178.26.5',
  33. changeOrigin: true,
  34. rewrite: (p) => p.replace(/^\/prod-api/, '')
  35. }
  36. }
  37. },
  38. })