1234567891011121314151617181920212223242526272829
  1. const path = require('path')
  2. const resolve = dir => path.join(__dirname, dir)
  3. module.exports = {
  4. devServer: {
  5. proxy: {
  6. '/api': {
  7. target: "http://192.168.89.147:8089/",
  8. // ws: true,
  9. changeOrigin: true,
  10. // pathRewrite: {
  11. // // 路径重写
  12. // "/api": "" // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上
  13. // }
  14. },
  15. },
  16. },
  17. lintOnSave: false,
  18. publicPath: "./",//在vue-cli.3.3版本后 baseUrl被废除了,因此这边要写成 publicPath。 https://cli.vuejs.org/zh/config/#vue-config-js
  19. runtimeCompiler: true,
  20. chainWebpack: config => {
  21. config.resolve.alias.set("@", resolve("src"));
  22. }
  23. }