vue.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. let proxy = {
  2. "/api": {
  3. target: "https://192.168.10.39:8878",
  4. changeOrigin: true
  5. }
  6. };
  7. // const stu = [
  8. // "/api/ecs_oe",
  9. // "/api/ecs_oe_student/",
  10. // "/api/sys_param",
  11. // "/api/exam_record",
  12. // "/api/exam_control",
  13. // "/api/exam_question",
  14. // "/api/exam_score",
  15. // "/api/practice_course",
  16. // "/api/practice_detail",
  17. // "/api/practice_record",
  18. // "/api/exam_captures",
  19. // "/api/face_capture",
  20. // "/api/face_verify",
  21. // "/api/offline_exam"
  22. // ];
  23. // for (const s of stu) {
  24. // proxy[s] = {
  25. // target: "http://ecs-dev.qmth.com.cn:8003", // 陈恳
  26. // changeOrigin: true
  27. // };
  28. // }
  29. // const mock = [{ source: "/api/mock/exam_question", dest: "/examQuestions" }];
  30. // for (const m of mock) {
  31. // proxy[m.source] = {
  32. // target: "http://localhost:3000/",
  33. // changeOrigin: true,
  34. // pathRewrite: {
  35. // ".*": m.dest
  36. // }
  37. // };
  38. // }
  39. var webpack = require("webpack");
  40. const plugins = [];
  41. // Ignore all locale files of moment.js
  42. // TODO: use webpack stats to check if iview locale matters
  43. plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment|iview$/));
  44. if (process.env.NODE_ENV === "production") {
  45. plugins.push("transform-remove-console");
  46. }
  47. module.exports = {
  48. devServer: {
  49. proxy
  50. },
  51. chainWebpack: config => {
  52. // iview Loader
  53. config.module
  54. .rule("vue")
  55. .test(/\.vue$/)
  56. .use("iview-loader")
  57. .loader("iview-loader")
  58. .options({
  59. prefix: true
  60. })
  61. .end();
  62. },
  63. configureWebpack: {
  64. plugins
  65. }
  66. };