vue.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const { defineConfig } = require("@vue/cli-service");
  2. const path = require("path");
  3. module.exports = defineConfig({
  4. transpileDependencies: true,
  5. lintOnSave: false,
  6. devServer: {
  7. client: {
  8. overlay: false // 编译错误时,取消全屏覆盖(建议关掉)
  9. },
  10. // port: 8080,
  11. // host: "localhost",
  12. // https: false,
  13. // open: true,
  14. proxy: {
  15. "/admin": {
  16. target: process.env.VUE_APP_BASE_URL,
  17. ws: true,
  18. changeOrigin: true,
  19. pathRewrite: {
  20. "^/admin": "/admin"
  21. }
  22. },
  23. "/api": {
  24. target: "http://192.168.1.108:8083",
  25. ws: true,
  26. changeOrigin: true,
  27. pathRewrite: {
  28. "^/api": ""
  29. }
  30. }
  31. }
  32. },
  33. chainWebpack: (config) => {
  34. config.resolve.alias.set("@", path.resolve(__dirname, "src"));
  35. config.plugin("define").tap((definitions) => {
  36. Object.assign(definitions[0], {
  37. __VUE_OPTIONS_API__: "true",
  38. __VUE_PROD_DEVTOOLS__: false,
  39. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
  40. });
  41. return definitions;
  42. });
  43. }
  44. });