vue.config.js 3.1 KB

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