vue.config.js 630B

123456789101112131415161718192021222324252627
  1. const path = require('path')
  2. module.exports = {
  3. devServer: {
  4. proxy: {
  5. '/api': {
  6. target: "http://192.168.89.147:8081/",
  7. // ws: true,
  8. changeOrigin: true,
  9. // pathRewrite: {
  10. // // 路径重写
  11. // "/api": "" // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上
  12. // }
  13. },
  14. },
  15. },
  16. publicPath: './',
  17. chainWebpack (config) {
  18. config.resolve.alias
  19. .set('@/components', path.resolve(__dirname, 'src/components/'))
  20. .set('@/utils', path.resolve(__dirname, 'src/utils/'))
  21. }
  22. }