vue.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // const { defineConfig } = require('@vue/cli-service')
  2. // module.exports = defineConfig({
  3. // transpileDependencies: true,
  4. // lintOnSave:false
  5. // })
  6. module.exports = {
  7. pages:{
  8. index:{
  9. //入口
  10. entry:'src/main.js',
  11. },
  12. },
  13. lintOnSave:false, //关闭语法检查
  14. // 开启代理服务器(方式一)
  15. // devServer: {
  16. // proxy: 'http://localhost:5000'
  17. // },
  18. // 开启代理服务器(方式二)
  19. devServer: {
  20. proxy: {
  21. '/api': { //此处的/api是请求前缀,也可以换成其它的名称,比如:/atguigu
  22. target: 'http://localhost:5000',
  23. pathRewrite:{'^/api':''}, //表示转发给服务器时,将前缀去掉,否则请求不成功
  24. ws: true, // 用于支持websocket,默认为true
  25. changeOrigin: true //用于控制请求头中的host值,默认为true
  26. },
  27. '/demo': {
  28. target: 'http://localhost:5001',
  29. pathRewrite:{'^/demo':''},
  30. ws: true,
  31. changeOrigin: true
  32. },
  33. }
  34. }
  35. }