vue.config.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. let targetUrl = "https://test.gym.lexiaoya.cn";
  2. // let targetUrl = "http://192.168.3.26:8000";
  3. // let targetUrl = 'http://192.168.3.20:8000'
  4. // let targetUrl = 'https://online.gym.lexiaoya.cn'
  5. // let targetUrl = 'http://dev.gym.lexiaoya.cn/'
  6. // let targetUrl = 'http://192.168.3.124:8000'
  7. module.exports = {
  8. publicPath: "./",
  9. chainWebpack: (config) => {
  10. config.devtool("inline-source-map");
  11. config.output.filename("[name].[hash].js").end();
  12. // // chunkHash
  13. // config.output.filename(`js/[name].[chunkhash].${Version}.js`).end();
  14. // config.output.chunkFilename(`js/[id].[chunkhash].${Version}.js`).end();
  15. // config.output.filename(`js/[name].[chunkhash].js`).end();
  16. // config.output.chunkFilename(`js/[id].[chunkhash].js`).end();
  17. // config.entry.app = ['babel-polyfill', './src/main.js']
  18. // config.resolve.symlinks(true)
  19. // config.plugin('html').tap(args => {
  20. // args[0].chunksSortMode = 'none'
  21. // return args
  22. // })
  23. config.plugin("html").tap((args) => {
  24. args[0].minify = {
  25. removeAttributeQuotes: false,
  26. };
  27. return args;
  28. });
  29. },
  30. // eslint-loader 是否在保存的时候检查
  31. lintOnSave: true,
  32. // 是否使用包含运行时编译器的Vue核心的构建
  33. runtimeCompiler: false,
  34. // 生产环境 sourceMap
  35. productionSourceMap: false,
  36. configureWebpack: () => {},
  37. // 配置 webpack-dev-server 行为。
  38. devServer: {
  39. open: process.platform === "darwin",
  40. host: "0.0.0.0",
  41. port: 9999,
  42. // https: true,
  43. hotOnly: false,
  44. // 查阅 https://github.com/vuejs/vue-doc-zh-cn/vue-cli/cli-service.md#配置代理
  45. proxy: {
  46. "/contracts": {
  47. target: targetUrl,
  48. changeOrigin: true,
  49. ws: true,
  50. "^/contracts": "/contracts",
  51. xfwd: true,
  52. },
  53. "/api-student": {
  54. target: targetUrl,
  55. changeOrigin: true,
  56. ws: true,
  57. "^/api-student": "/api-student",
  58. xfwd: true,
  59. },
  60. "/api-cms": {
  61. target: targetUrl,
  62. changeOrigin: true,
  63. ws: true,
  64. "^/api-cms": "/api-cms",
  65. xfwd: true,
  66. },
  67. "/api-teacher": {
  68. target: targetUrl,
  69. changeOrigin: true,
  70. ws: true,
  71. "^/api-teacher": "/api-teacher",
  72. xfwd: true,
  73. },
  74. "/api-web": {
  75. target: targetUrl,
  76. changeOrigin: true,
  77. ws: true,
  78. "^/api-web": "/api-web",
  79. xfwd: true,
  80. },
  81. "/api-auth": {
  82. target: targetUrl,
  83. changeOrigin: true,
  84. ws: true,
  85. "^/api-auth": "/api-auth",
  86. xfwd: true,
  87. },
  88. "/api-mall-portal": {
  89. target: targetUrl,
  90. changeOrigin: true,
  91. },
  92. "/api-oa": {
  93. target: targetUrl,
  94. changeOrigin: true,
  95. ws: true,
  96. "^/api-oa": "/api-oa",
  97. xfwd: true,
  98. },
  99. }, // string | Object
  100. },
  101. css: {
  102. loaderOptions: {
  103. less: {
  104. modifyVars: {
  105. // red: '#03a9f4',
  106. blue: "#01C1B5",
  107. // orange: '#f08d49',
  108. // 'text-color': '#111'
  109. },
  110. },
  111. },
  112. },
  113. };