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