index.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. var path = require("path");
  3. const TEST_HOST = "http://101.36.160.140:10310";
  4. // const TEST_HOST = "http://172.16.0.46:9025";
  5. // const TEST_HOST = "http://172.16.0.46:9527";
  6. module.exports = {
  7. build: {
  8. prodEnv: require("./prod.env"),
  9. index: path.resolve(__dirname, "../dist/index.html"),
  10. assetsRoot: path.resolve(__dirname, "../dist"),
  11. assetsSubDirectory: "static",
  12. assetsPublicPath: "./", //请根据自己路径配置更改
  13. productionSourceMap: false,
  14. // baseURL: TEST_HOST,
  15. // Gzip off by default as many popular static hosts such as
  16. // Surge or Netlify already gzip all static assets for you.
  17. // Before setting to `true`, make sure to:
  18. // npm install --save-dev compression-webpack-plugin
  19. productionGzip: false,
  20. productionGzipExtensions: ["js", "css"],
  21. // Run the build command with an extra argument to
  22. // View the bundle analyzer report after build finishes:
  23. // `npm run build --report`
  24. // Set to `true` or `false` to always turn it on or off
  25. bundleAnalyzerReport: process.env.npm_config_report,
  26. },
  27. build_test: {
  28. prodEnv: require("./test.env"),
  29. index: path.resolve(__dirname, "../dist/index.html"),
  30. assetsRoot: path.resolve(__dirname, "../dist"),
  31. assetsSubDirectory: "static",
  32. assetsPublicPath: "./", //请根据自己路径配置更改
  33. productionSourceMap: false,
  34. // baseURL: TEST_HOST,
  35. // Gzip off by default as many popular static hosts such as
  36. // Surge or Netlify already gzip all static assets for you.
  37. // Before setting to `true`, make sure to:
  38. // npm install --save-dev compression-webpack-plugin
  39. productionGzip: false,
  40. productionGzipExtensions: ["js", "css"],
  41. // Run the build command with an extra argument to
  42. // View the bundle analyzer report after build finishes:
  43. // `npm run build --report`
  44. // Set to `true` or `false` to always turn it on or off
  45. bundleAnalyzerReport: process.env.npm_config_report,
  46. },
  47. dev: {
  48. host: "localhost", // can be overwritten by process.env.HOST
  49. env: require("./dev.env"),
  50. port: 9527,
  51. autoOpenBrowser: true,
  52. assetsSubDirectory: "static",
  53. assetsPublicPath: "/",
  54. proxyTable: {
  55. "/depot-system": {
  56. target: TEST_HOST,
  57. secure: false, // 如果是https接口,需要配置这个参数
  58. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  59. pathRewrite: {
  60. "^/api": "",
  61. },
  62. },
  63. "/depot-smart-storage": {
  64. target: TEST_HOST,
  65. secure: false, // 如果是https接口,需要配置这个参数
  66. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  67. pathRewrite: {
  68. "^/api": "",
  69. },
  70. },
  71. "/depot-business": {
  72. target: TEST_HOST,
  73. secure: false, // 如果是https接口,需要配置这个参数
  74. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  75. pathRewrite: {
  76. "^/api": "",
  77. },
  78. },
  79. "/depot-agent": {
  80. target: TEST_HOST,
  81. secure: false, // 如果是https接口,需要配置这个参数
  82. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  83. pathRewrite: {
  84. "^/api": "",
  85. },
  86. },
  87. "/depot-basic": {
  88. target: TEST_HOST,
  89. secure: false, // 如果是https接口,需要配置这个参数
  90. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  91. pathRewrite: {
  92. "^/api": "",
  93. },
  94. },
  95. "/depot-storage": {
  96. target: TEST_HOST,
  97. secure: false, // 如果是https接口,需要配置这个参数
  98. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  99. pathRewrite: {
  100. "^/api": "",
  101. },
  102. },
  103. "/depot-qualitycheck": {
  104. target: TEST_HOST,
  105. secure: false, // 如果是https接口,需要配置这个参数
  106. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  107. logLevel: "debug",
  108. // onProxyReq: (proxyReq, req) => {
  109. // // http请求
  110. // // console.log('[HPM] %s %s %s %s', req.method, req.originalUrl, '->', req.url);
  111. // console.log('proxyReq', proxyReq.headers);
  112. // console.log('req', req.headers);
  113. // },
  114. pathRewrite: {
  115. "^/api": "",
  116. },
  117. },
  118. "/depot-device": {
  119. target: TEST_HOST,
  120. secure: false, // 如果是https接口,需要配置这个参数
  121. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  122. pathRewrite: {
  123. "^/api": "",
  124. },
  125. },
  126. "/depot-keeper-account": {
  127. target: TEST_HOST,
  128. secure: false, // 如果是https接口,需要配置这个参数
  129. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  130. pathRewrite: {
  131. "^/api": "",
  132. },
  133. },
  134. "/depot-agile": {
  135. target: TEST_HOST,
  136. secure: false, // 如果是https接口,需要配置这个参数
  137. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  138. pathRewrite: {
  139. "^/api": "",
  140. },
  141. },
  142. "/depot-monitor": {
  143. target: TEST_HOST,
  144. secure: false, // 如果是https接口,需要配置这个参数
  145. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  146. pathRewrite: {
  147. "^/api": "",
  148. },
  149. },
  150. "/depot-smart-storage": {
  151. target: TEST_HOST,
  152. secure: false, // 如果是https接口,需要配置这个参数
  153. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  154. pathRewrite: {
  155. "^/api": "",
  156. },
  157. },
  158. "/loginApi": {
  159. target: TEST_HOST,
  160. secure: false, //如果是https接口,需要配置这个参数
  161. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  162. pathRewrite: {
  163. "^/loginApi": "",
  164. },
  165. },
  166. },
  167. // CSS Sourcemaps off by default because relative paths are "buggy"
  168. // with this option, according to the CSS-Loader README
  169. // (https://github.com/webpack/css-loader#sourcemaps)
  170. // In our experience, they generally work as expected,
  171. // just be aware of this issue when enabling this option.
  172. cssSourceMap: false,
  173. },
  174. };