vue.config.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. 'use strict'
  2. const path = require('path')
  3. function resolve(dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. const name = process.env.VUE_APP_TITLE || '云联私域管理系统' // 网页标题
  7. const port = process.env.port || process.env.npm_config_port || 80 // 端口
  8. // vue.config.js 配置说明
  9. //官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
  10. // 这里只列一部分,具体配置参考文档
  11. module.exports = {
  12. // 部署生产环境和开发环境下的URL。
  13. // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
  14. // 例如 https://www.test.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.test.vip/admin/,则设置 baseUrl 为 /admin/。
  15. publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
  16. // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
  17. outputDir: 'dist',
  18. // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
  19. assetsDir: 'static',
  20. // 是否开启eslint保存检测,有效值:ture | false | 'error'
  21. lintOnSave: process.env.NODE_ENV === 'development',
  22. // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
  23. productionSourceMap: false,
  24. // transpileDependencies: true, // 默认情况下 babel-loader 忽略 node_modules 中的所有文件,启用此选项需配置transpileDependencies
  25. transpileDependencies: [
  26. /@aws-sdk/,
  27. /@aws/,
  28. /@smithy/,
  29. /@huaweicloud/,
  30. /vod-js-sdk-v6/
  31. ],
  32. // webpack-dev-server 相关配置
  33. devServer: {
  34. host: '0.0.0.0',
  35. port: port,
  36. open: true,
  37. disableHostCheck: true,
  38. proxy: {
  39. // ===== 前端路径与后端不一致的路径重写 → fs-company(8006) =====
  40. //
  41. // saasadminui 前端 API 路径与 fs-company 后端控制器路径存在以下不一致:
  42. // 1. /store/store/* → 后端是 /store/* (前端多了一层 store)
  43. // 2. /store/his/* → 后端是 /his/* (前端 store/his 实际是 his)
  44. // 3. /his/fsXxx → 后端是 /store/xxx (his/fs 前缀映射到 store)
  45. // 4. /his_store/* → 后端是 /hisStore/* (下划线 vs 驼峰)
  46. // 5. /admin/medical/* → 路由到 fs-saasadmin(8002)
  47. // 6. /fast_gpt/* → 后端是 /fastGpt/*
  48. // 7. /wx/wxSop* → 后端是 /qwSop/sopUserLogs*
  49. // 8. /wxSop/sopUserLogsWx → 后端是 /qwSop/sopUserLogs
  50. // 9. /sop/companySopRole → 后端是 /companySopRole
  51. //
  52. // === 批量路径重写:/store/store/ → /store/ (仅匹配 hisStore 二级目录下的 store 前缀) ===
  53. // 注意:此规则仅匹配前端 api/hisStore/store*.js 中 url 以 /store/store/ 开头的请求
  54. // 不匹配 /store/storeProduct 等路径
  55. [process.env.VUE_APP_BASE_API + '/store/store/']: {
  56. target: 'http://localhost:8006',
  57. changeOrigin: true,
  58. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/store/']: '/store/' }
  59. },
  60. // === /store/store/storeOrder → /hisStore/fsStoreOrderScrm (hisStore订单API在fs-admin-saas) ===
  61. [process.env.VUE_APP_BASE_API + '/store/store/storeOrder']: {
  62. target: 'http://localhost:8006',
  63. changeOrigin: true,
  64. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/store/storeOrder']: '/hisStore/fsStoreOrderScrm' }
  65. },
  66. // === 批量路径重写:/store/his/* → /his/* ===
  67. [process.env.VUE_APP_BASE_API + '/store/his']: {
  68. target: 'http://localhost:8006',
  69. changeOrigin: true,
  70. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/his']: '/his' }
  71. },
  72. // === 批量路径重写:/store/doctor/* → /his/doctor/* ===
  73. [process.env.VUE_APP_BASE_API + '/store/doctor']: {
  74. target: 'http://localhost:8006',
  75. changeOrigin: true,
  76. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/doctor']: '/his/doctor' }
  77. },
  78. // === 批量路径重写:/store/healthTongue/* → /his/healthTongue/* ===
  79. [process.env.VUE_APP_BASE_API + '/store/healthTongue']: {
  80. target: 'http://localhost:8006',
  81. changeOrigin: true,
  82. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/healthTongue']: '/his/healthTongue' }
  83. },
  84. // === 批量路径重写:/store/inquiryOrder/* → /his/inquiryOrder/* ===
  85. [process.env.VUE_APP_BASE_API + '/store/inquiryOrder']: {
  86. target: 'http://localhost:8006',
  87. changeOrigin: true,
  88. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/inquiryOrder']: '/his/inquiryOrder' }
  89. },
  90. // === 批量路径重写:/store/prescribeDrug/* → /his/prescribeDrug/* ===
  91. [process.env.VUE_APP_BASE_API + '/store/prescribeDrug']: {
  92. target: 'http://localhost:8006',
  93. changeOrigin: true,
  94. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/prescribeDrug']: '/his/prescribeDrug' }
  95. },
  96. // === 批量路径重写:/store/healthStoreOrder/* → /hisStore/fsStoreOrderScrm/* ===
  97. [process.env.VUE_APP_BASE_API + '/store/healthStoreOrder']: {
  98. target: 'http://localhost:8006',
  99. changeOrigin: true,
  100. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/healthStoreOrder']: '/hisStore/fsStoreOrderScrm' }
  101. },
  102. // === 批量路径重写:/store/operlogScrm/* → /hisStore/operlogScrm/* ===
  103. [process.env.VUE_APP_BASE_API + '/store/operlogScrm']: {
  104. target: 'http://localhost:8006',
  105. changeOrigin: true,
  106. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/operlogScrm']: '/hisStore/operlogScrm' }
  107. },
  108. // === 批量路径重写:/store/storeOrderOffline/* → /hisStore/fsStoreOrderOfflineScrm/* ===
  109. [process.env.VUE_APP_BASE_API + '/store/storeOrderOffline']: {
  110. target: 'http://localhost:8006',
  111. changeOrigin: true,
  112. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/storeOrderOffline']: '/hisStore/fsStoreOrderOfflineScrm' }
  113. },
  114. // === 批量路径重写:/store/storeOrderAudit/* → /hisStore/fsStoreOrderAuditScrm/* ===
  115. [process.env.VUE_APP_BASE_API + '/store/storeOrderAudit']: {
  116. target: 'http://localhost:8006',
  117. changeOrigin: true,
  118. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/storeOrderAudit']: '/hisStore/fsStoreOrderAuditScrm' }
  119. },
  120. // === 批量路径重写:/store/recommend/* → /store/storeRecommend/* ===
  121. [process.env.VUE_APP_BASE_API + '/store/recommend']: {
  122. target: 'http://localhost:8006',
  123. changeOrigin: true,
  124. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/recommend']: '/store/storeRecommend' }
  125. },
  126. // === 批量路径重写:/store/storeActivity/* → /hisStore/fsStoreActivityScrm/* ===
  127. [process.env.VUE_APP_BASE_API + '/store/storeActivity']: {
  128. target: 'http://localhost:8006',
  129. changeOrigin: true,
  130. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/storeActivity']: '/hisStore/fsStoreActivityScrm' }
  131. },
  132. // === 批量路径重写:/store/collectionSchedule/* → /hisStore/fsCollectionScheduleScrm/* ===
  133. [process.env.VUE_APP_BASE_API + '/store/collectionSchedule']: {
  134. target: 'http://localhost:8006',
  135. changeOrigin: true,
  136. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/store/collectionSchedule']: '/hisStore/fsCollectionScheduleScrm' }
  137. },
  138. // === his_store/* → hisStore/* (下划线转驼峰) ===
  139. [process.env.VUE_APP_BASE_API + '/his_store']: {
  140. target: 'http://localhost:8006',
  141. changeOrigin: true,
  142. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his_store']: '/hisStore' }
  143. },
  144. // === /admin/medical/* → 已在fs-saas(8006)上通过CompanyBridgeController(@Profile("company"))提供,无需单独代理到8002 ===
  145. // === /fast_gpt/* → /fastGpt/* ===
  146. [process.env.VUE_APP_BASE_API + '/fast_gpt']: {
  147. target: 'http://localhost:8006',
  148. changeOrigin: true,
  149. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/fast_gpt']: '/fastGpt' }
  150. },
  151. // === /wxSop/sopUserLogsWx → /qwSop/sopUserLogs ===
  152. [process.env.VUE_APP_BASE_API + '/wxSop/sopUserLogsWx']: {
  153. target: 'http://localhost:8006',
  154. changeOrigin: true,
  155. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wxSop/sopUserLogsWx']: '/qwSop/sopUserLogs' }
  156. },
  157. // === /sop/companySopRole → /companySopRole ===
  158. [process.env.VUE_APP_BASE_API + '/sop/companySopRole']: {
  159. target: 'http://localhost:8006',
  160. changeOrigin: true,
  161. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/sop/companySopRole']: '/companySopRole' }
  162. },
  163. // === /company/ 路径无需特殊重写,走全局代理(只去掉 /dev-api 前缀,保留 /company/xxx)===
  164. // === /qw/qwInformation → /qw/information ===
  165. [process.env.VUE_APP_BASE_API + '/qw/qwInformation']: {
  166. target: 'http://localhost:8006',
  167. changeOrigin: true,
  168. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwInformation']: '/qw/information' }
  169. },
  170. // === /qw/qwAppContactWayLogs → /qw/appContactWayLogs ===
  171. [process.env.VUE_APP_BASE_API + '/qw/qwAppContactWayLogs']: {
  172. target: 'http://localhost:8006',
  173. changeOrigin: true,
  174. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwAppContactWayLogs']: '/qw/appContactWayLogs' }
  175. },
  176. // === /qw/qwPushCount → /qw/pushCount ===
  177. [process.env.VUE_APP_BASE_API + '/qw/qwPushCount']: {
  178. target: 'http://localhost:8006',
  179. changeOrigin: true,
  180. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwPushCount']: '/qw/pushCount' }
  181. },
  182. // === /qw/records → /qw/record ===
  183. [process.env.VUE_APP_BASE_API + '/qw/records']: {
  184. target: 'http://localhost:8006',
  185. changeOrigin: true,
  186. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/records']: '/qw/record' }
  187. },
  188. // === /qw/workLinkUser → /qw/workLink ===
  189. [process.env.VUE_APP_BASE_API + '/qw/workLinkUser']: {
  190. target: 'http://localhost:8006',
  191. changeOrigin: true,
  192. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/workLinkUser']: '/qw/workLink' }
  193. },
  194. // === /qw/workUser → /qw/work ===
  195. [process.env.VUE_APP_BASE_API + '/qw/workUser']: {
  196. target: 'http://localhost:8006',
  197. changeOrigin: true,
  198. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/workUser']: '/qw/work' }
  199. },
  200. // === /qw/analyze → /qw/analyze (直接透传) ===
  201. // === /qw/customerProperty → /qw/customerProperty (直接透传) ===
  202. // === /crm/assist → /crm/assist (直接透传) ===
  203. // === /crm/analyze → /crm/analyze (直接透传) ===
  204. // === /crm/third → /crm/third (直接透传) ===
  205. // === /crm/event → /crm/event (直接透传) ===
  206. // === /crm/report → /crm/report (直接透传) ===
  207. // === /crm/customerHisOrder → /crm/customerHisOrder (直接透传) ===
  208. // === /crm/msg → /crm/msg (直接透传) ===
  209. // === /his/aiWorkflow → /his/aiWorkflow (直接透传) ===
  210. // his/fsXxx → store/xxx(saasadminui 用 his/fs 前缀,后端用 store)
  211. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrder']: {
  212. target: 'http://localhost:8006',
  213. changeOrigin: true,
  214. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrder']: '/store/storeOrder' }
  215. },
  216. [process.env.VUE_APP_BASE_API + '/his/fsInquiryOrderReport']: {
  217. target: 'http://localhost:8006',
  218. changeOrigin: true,
  219. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsInquiryOrderReport']: '/store/inquiryOrderReport' }
  220. },
  221. [process.env.VUE_APP_BASE_API + '/his/fsInquiryOrder']: {
  222. target: 'http://localhost:8006',
  223. changeOrigin: true,
  224. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsInquiryOrder']: '/store/inquiryOrder' }
  225. },
  226. [process.env.VUE_APP_BASE_API + '/his/fsDrugReportCount']: {
  227. target: 'http://localhost:8006',
  228. changeOrigin: true,
  229. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsDrugReportCount']: '/store/drugReportCount' }
  230. },
  231. [process.env.VUE_APP_BASE_API + '/his/fsDrugReport']: {
  232. target: 'http://localhost:8006',
  233. changeOrigin: true,
  234. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsDrugReport']: '/store/drugReport' }
  235. },
  236. [process.env.VUE_APP_BASE_API + '/his/fsHealthData']: {
  237. target: 'http://localhost:8006',
  238. changeOrigin: true,
  239. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsHealthData']: '/store/healthData' }
  240. },
  241. [process.env.VUE_APP_BASE_API + '/his/fsHealthRecord']: {
  242. target: 'http://localhost:8006',
  243. changeOrigin: true,
  244. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsHealthRecord']: '/store/healthRecord' }
  245. },
  246. [process.env.VUE_APP_BASE_API + '/his/fsUserOnlineState']: {
  247. target: 'http://localhost:8006',
  248. changeOrigin: true,
  249. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserOnlineState']: '/store/userOnlineState' }
  250. },
  251. [process.env.VUE_APP_BASE_API + '/his/fsUserCoupon']: {
  252. target: 'http://localhost:8006',
  253. changeOrigin: true,
  254. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserCoupon']: '/store/userCoupon' }
  255. },
  256. [process.env.VUE_APP_BASE_API + '/his/fsUserAddress']: {
  257. target: 'http://localhost:8006',
  258. changeOrigin: true,
  259. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserAddress']: '/store/userAddress' }
  260. },
  261. [process.env.VUE_APP_BASE_API + '/his/fsUser']: {
  262. target: 'http://localhost:8006',
  263. changeOrigin: true,
  264. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUser']: '/store/user' }
  265. },
  266. [process.env.VUE_APP_BASE_API + '/his/fsMaterialGroup']: {
  267. target: 'http://localhost:8006',
  268. changeOrigin: true,
  269. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsMaterialGroup']: '/store/materialGroup' }
  270. },
  271. [process.env.VUE_APP_BASE_API + '/his/fsMaterial']: {
  272. target: 'http://localhost:8006',
  273. changeOrigin: true,
  274. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsMaterial']: '/store/material' }
  275. },
  276. [process.env.VUE_APP_BASE_API + '/his/fsExportTask']: {
  277. target: 'http://localhost:8006',
  278. changeOrigin: true,
  279. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsExportTask']: '/store/exportTask' }
  280. },
  281. [process.env.VUE_APP_BASE_API + '/his/fsCoupon']: {
  282. target: 'http://localhost:8006',
  283. changeOrigin: true,
  284. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCoupon']: '/store/coupon' }
  285. },
  286. [process.env.VUE_APP_BASE_API + '/his/fsPatient']: {
  287. target: 'http://localhost:8006',
  288. changeOrigin: true,
  289. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPatient']: '/store/patient' }
  290. },
  291. [process.env.VUE_APP_BASE_API + '/his/fsPackage']: {
  292. target: 'http://localhost:8006',
  293. changeOrigin: true,
  294. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPackage']: '/store/package' }
  295. },
  296. [process.env.VUE_APP_BASE_API + '/his/fsStoreProductCategory']: {
  297. target: 'http://localhost:8006',
  298. changeOrigin: true,
  299. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreProductCategory']: '/store/storeProductCategory' }
  300. },
  301. [process.env.VUE_APP_BASE_API + '/his/fsStoreProduct']: {
  302. target: 'http://localhost:8006',
  303. changeOrigin: true,
  304. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreProduct']: '/store/storeProduct' }
  305. },
  306. [process.env.VUE_APP_BASE_API + '/his/fsStoreAfterSales']: {
  307. target: 'http://localhost:8006',
  308. changeOrigin: true,
  309. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreAfterSales']: '/store/storeAfterSales' }
  310. },
  311. [process.env.VUE_APP_BASE_API + '/his/fsPayment']: {
  312. target: 'http://localhost:8006',
  313. changeOrigin: true,
  314. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPayment']: '/store/storePayment' }
  315. },
  316. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderOffline']: {
  317. target: 'http://localhost:8006',
  318. changeOrigin: true,
  319. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderOffline']: '/hisStore/fsStoreOrderOfflineScrm' }
  320. },
  321. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderAudit']: {
  322. target: 'http://localhost:8006',
  323. changeOrigin: true,
  324. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderAudit']: '/hisStore/fsStoreOrderAuditScrm' }
  325. },
  326. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderBillLog']: {
  327. target: 'http://localhost:8006',
  328. changeOrigin: true,
  329. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderBillLog']: '/bill/billLog' }
  330. },
  331. [process.env.VUE_APP_BASE_API + '/his/fsStoreStatistics']: {
  332. target: 'http://localhost:8006',
  333. changeOrigin: true,
  334. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreStatistics']: '/hisStore/fsStoreStatisticsScrm' }
  335. },
  336. [process.env.VUE_APP_BASE_API + '/his/fsIcd']: {
  337. target: 'http://localhost:8006',
  338. changeOrigin: true,
  339. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsIcd']: '/store/icd' }
  340. },
  341. [process.env.VUE_APP_BASE_API + '/his/fsPrescribe']: {
  342. target: 'http://localhost:8006',
  343. changeOrigin: true,
  344. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPrescribe']: '/store/prescribe' }
  345. },
  346. [process.env.VUE_APP_BASE_API + '/his/fsFollowTemp']: {
  347. target: 'http://localhost:8006',
  348. changeOrigin: true,
  349. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsFollowTemp']: '/store/followTemp' }
  350. },
  351. [process.env.VUE_APP_BASE_API + '/his/fsCollectionSchedule']: {
  352. target: 'http://localhost:8006',
  353. changeOrigin: true,
  354. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCollectionSchedule']: '/store/collectionSchedule' }
  355. },
  356. [process.env.VUE_APP_BASE_API + '/his/fsCollection']: {
  357. target: 'http://localhost:8006',
  358. changeOrigin: true,
  359. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCollection']: '/store/collection' }
  360. },
  361. // his/fsFirstDiagnosis → his/diagnosis
  362. [process.env.VUE_APP_BASE_API + '/his/fsFirstDiagnosis']: {
  363. target: 'http://localhost:8006',
  364. changeOrigin: true,
  365. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsFirstDiagnosis']: '/his/diagnosis' }
  366. },
  367. // hisStore/collection → store/collection
  368. [process.env.VUE_APP_BASE_API + '/hisStore/collection']: {
  369. target: 'http://localhost:8006',
  370. changeOrigin: true,
  371. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/collection']: '/store/collection' }
  372. },
  373. // wx/wxSop* → qwSop/sopUserLogs* (企微SOP)
  374. [process.env.VUE_APP_BASE_API + '/wx/wxSopUserInfo']: {
  375. target: 'http://localhost:8006',
  376. changeOrigin: true,
  377. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopUserInfo']: '/qwSop/sopUserLogsInfo' }
  378. },
  379. [process.env.VUE_APP_BASE_API + '/wx/wxSopUser']: {
  380. target: 'http://localhost:8006',
  381. changeOrigin: true,
  382. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopUser']: '/qwSop/sopUserLogs' }
  383. },
  384. [process.env.VUE_APP_BASE_API + '/wx/wxSopLogs']: {
  385. target: 'http://localhost:8006',
  386. changeOrigin: true,
  387. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopLogs']: '/qwSop/sopUserLogsInfo' }
  388. },
  389. [process.env.VUE_APP_BASE_API + '/wx/wxSop']: {
  390. target: 'http://localhost:8006',
  391. changeOrigin: true,
  392. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSop']: '/qwSop/sopUserLogs' }
  393. },
  394. // === /live/coupon → /live/coupon (直接透传,后端已有) ===
  395. // === /live/liveLotteryProductConf → /live/liveLotteryProductConf (直接透传) ===
  396. // === /live/liveAfterSalesLogs → /live/liveAfterSalesLogs (直接透传) ===
  397. // === /live/liveEventConf → /live/liveEventConf (直接透传) ===
  398. // === /live/liveOrderStatus → /live/liveOrderStatus (直接透传) ===
  399. // === /live/liveUserRedRecord → /live/liveUserRedRecord (直接透传) ===
  400. // === /live/trafficLog → /live/trafficLog (直接透传) ===
  401. // === /live/comment → /live/comment (直接透传) ===
  402. // === /course/userVideoComment → /course/userVideoComment (直接透传) ===
  403. // === /course/userCourseComment → /course/userCourseComment (直接透传) ===
  404. // === /course/userCourseNote → /course/userCourseNote (直接透传) ===
  405. // === /course/userCourseStudy → /course/userCourseStudy (直接透传) ===
  406. // === /course/userTalent → /course/userTalent (直接透传) ===
  407. // === /course/statistics → /course/statistics (直接透传) ===
  408. // === /course/courseQuestionCategory → /course/courseQuestionCategory (直接透传) ===
  409. // === /course/fsCourseProduct → /course/fsCourseProduct (直接透传) ===
  410. // === /course/fsUserCoursePeriodDays → /course/fsUserCoursePeriodDays (直接透传) ===
  411. // === /course/courseWatchComment → /course/courseWatchComment (直接透传) ===
  412. // === /course/videoTags → /course/videoTags (直接透传) ===
  413. // === /course/videoResource → /course/videoResource (直接透传) ===
  414. // === /his/patient → /his/patient (直接透传) ===
  415. // === /his/store → /his/store (直接透传) ===
  416. // === /his/coupon → /his/coupon (直接透传) ===
  417. // === /his/doctorBill → /his/doctorBill (直接透传) ===
  418. // === /his/storeBill → /his/storeBill (直接透传) ===
  419. // === /his/storeLog → /his/storeLog (直接透传) ===
  420. // === /his/storeExtract → /his/storeExtract (直接透传) ===
  421. // === /his/storeSubOrder → /his/storeSubOrder (直接透传) ===
  422. // === /his/storeAfterSales → /his/storeAfterSales (直接透传) ===
  423. // === /his/storeProduct → /his/storeProduct (直接透传) ===
  424. // === /his/storeProductPackage → /his/storeProductPackage (直接透传) ===
  425. // === /his/storeActivity → /his/storeActivity (直接透传) ===
  426. // === /his/storeOrder → /his/storeOrder (直接透传) ===
  427. // === /his/user → /his/user (直接透传) ===
  428. // === /his/userBill → /his/userBill (直接透传) ===
  429. // === /his/userExtract → /his/userExtract (直接透传) ===
  430. // === /his/userRecharge → /his/userRecharge (直接透传) ===
  431. // === /his/userIntegralLogs → /his/userIntegralLogs (直接透传) ===
  432. // === /his/companyRecharge → /his/companyRecharge (直接透传) ===
  433. // === /his/companyDeduct → /his/companyDeduct (直接透传) ===
  434. // === /his/company → /his/company (直接透传) ===
  435. // === /his/doctorExtract → /his/doctorExtract (直接透传) ===
  436. // === /his/doctorArticle → /his/doctorArticle (直接透传) ===
  437. // === /his/doctorArticleCate → /his/doctorArticleCate (直接透传) ===
  438. // === /his/doctorOperLog → /his/doctorOperLog (直接透传) ===
  439. // === /his/doctorPrescribeDrug → /his/doctorPrescribeDrug (直接透传) ===
  440. // === /his/doctorPrescribe → /his/doctorPrescribe (直接透传) ===
  441. // === /his/doctorProduct → /his/doctorProduct (直接透传) ===
  442. // === /his/disease → /his/disease (直接透传) ===
  443. // === /his/illnessLibrary → /his/illnessLibrary (直接透传) ===
  444. // === /his/inquiryDisease → /his/inquiryDisease (直接透传) ===
  445. // === /his/inquiryOrderPing → /his/inquiryOrderPing (直接透传) ===
  446. // === /his/inquiryTemp → /his/inquiryTemp (直接透传) ===
  447. // === /his/hospital → /his/hospital (直接透传) ===
  448. // === /his/department → /his/department (直接透传) ===
  449. // === /his/vessel → /his/vessel (直接透传) ===
  450. // === /his/chineseMedicine → /his/chineseMedicine (直接透传) ===
  451. // === /his/famousPrescribe → /his/famousPrescribe (直接透传) ===
  452. // === /his/medicatedFood → /his/medicatedFood (直接透传) ===
  453. // === /his/healthLife → /his/healthLife (直接透传) ===
  454. // === /his/healthHistoryTemp → /his/healthHistoryTemp (直接透传) ===
  455. // === /his/physicalReportTemplate → /his/physicalReportTemplate (直接透传) ===
  456. // === /his/physicalReportTemplateField → /his/physicalReportTemplateField (直接透传) ===
  457. // === /his/testReport → /his/testReport (直接透传) ===
  458. // === /his/testTemp → /his/testTemp (直接透传) ===
  459. // === /his/testTempItem → /his/testTempItem (直接透传) ===
  460. // === /his/template → /his/template (直接透传) ===
  461. // === /his/questions → /his/questions (直接透传) ===
  462. // === /his/answer → /his/answer (直接透传) ===
  463. // === /his/packageCate → /his/packageCate (直接透传) ===
  464. // === /his/packageSolarTerm → /his/packageSolarTerm (直接透传) ===
  465. // === /his/packageFavorite → /his/packageFavorite (直接透传) ===
  466. // === /his/packageOrder → /his/packageOrder (直接透传) ===
  467. // === /his/dfAccount → /his/dfAccount (直接透传) ===
  468. // === /his/hfpayConfig → /his/hfpayConfig (直接透传) ===
  469. // === /his/doctorAdvice → /his/doctorAdvice (直接透传) ===
  470. // === /his/homeView → /his/homeView (直接透传) ===
  471. // === /his/homeArticle → /his/homeArticle (直接透传) ===
  472. // === /his/homeCategory → /his/homeCategory (直接透传) ===
  473. // === /his/articleCate → /his/articleCate (直接透传) ===
  474. // === /his/articleViews → /his/articleViews (直接透传) ===
  475. // === /his/caseArticle → /his/caseArticle (直接透传) ===
  476. // === /his/adv → /his/adv (直接透传) ===
  477. // === /his/price → /his/price (直接透传) ===
  478. // === /his/appVersion → /his/appVersion (直接透传) ===
  479. // === /his/express → /his/express (直接透传) ===
  480. // === /his/userAddress → /his/userAddress (直接透传) ===
  481. // === /his/userCoupon → /his/userCoupon (直接透传) ===
  482. // === /his/merchantAppConfig → /his/merchantAppConfig (直接透传) ===
  483. // === /his/pharmacist → /his/pharmacist (直接透传) ===
  484. // === /his/complaint → /his/complaint (直接透传) ===
  485. // === /his/healthArticle → /his/healthArticle (直接透传) ===
  486. // === /his/promotionActive → /his/promotionActive (直接透传) ===
  487. // === /his/promotionActiveLog → /his/promotionActiveLog (直接透传) ===
  488. // === /his/logs → /his/logs (直接透传) ===
  489. // === /his/userNewTask → /his/userNewTask (直接透传) ===
  490. // === /his/divItem → /his/divItem (直接透传) ===
  491. // === /his/icd → /his/icd (直接透传) ===
  492. // === /his/aiWorkflow → /his/aiWorkflow (直接透传) ===
  493. // === /his/healthData → /his/healthData (直接透传) ===
  494. // === /his/inquiryOrder → /his/inquiryOrder (直接透传) ===
  495. // === /his/drugReportCount → /his/drugReportCount (直接透传) ===
  496. // === /his/doctor → /his/doctor (直接透传) ===
  497. // === /his/prescription → /his/prescription (直接透传) ===
  498. // === /his/drugReport → /his/drugReport (直接透传) ===
  499. // === /his/exportTask → /his/exportTask (直接透传) ===
  500. // === /his/healthTongue → /his/healthTongue (直接透传) ===
  501. // === /his/healthRecord → /his/healthRecord (直接透传) ===
  502. // === /his/diagnosis → /his/diagnosis (直接透传) ===
  503. // === /his/healthRecordTemplate → /his/healthRecordTemplate (直接透传) ===
  504. // === /his/healthTongueQuestion → /his/healthTongueQuestion (直接透传) ===
  505. // === /his/followPlan → /his/followPlan (直接透传) ===
  506. // === /his/recoveryRecord → /his/recoveryRecord (直接透传) ===
  507. // === /his/recoveryPlan → /his/recoveryPlan (直接透传) ===
  508. // === /his/healthReport → /his/healthReport (直接透传) ===
  509. // === /his/inquiryOrderReport → /his/inquiryOrderReport (直接透传) ===
  510. // === /his/inquiryDisease → /his/inquiryDisease (直接透传) ===
  511. // === /his/integralGoods → /his/integralGoods (直接透传) ===
  512. // === /his/integralOrder → /his/integralOrder (直接透传) ===
  513. // === /his/redPacket → /his/redPacket (直接透传) ===
  514. // === /company/wxAccount → /company/wxUser (微信账号) ===
  515. [process.env.VUE_APP_BASE_API + '/company/wxAccount']: {
  516. target: 'http://localhost:8006',
  517. changeOrigin: true,
  518. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/company/wxAccount']: '/company/wxUser' }
  519. },
  520. // === /user/darkRoom → /store/user/darkRoomList (小黑屋) ===
  521. [process.env.VUE_APP_BASE_API + '/user/darkRoom']: {
  522. target: 'http://localhost:8006',
  523. changeOrigin: true,
  524. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/user/darkRoom']: '/store/user/darkRoomList' }
  525. },
  526. // === /user/transfer → /system/approval (转接管理) ===
  527. [process.env.VUE_APP_BASE_API + '/user/transfer']: {
  528. target: 'http://localhost:8006',
  529. changeOrigin: true,
  530. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/user/transfer']: '/system/approval' }
  531. },
  532. // === /lobster/billing → /workflow/lobster/billing (龙虾计费) ===
  533. [process.env.VUE_APP_BASE_API + '/lobster/billing']: {
  534. target: 'http://localhost:8006',
  535. changeOrigin: true,
  536. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/billing']: '/workflow/lobster/billing' }
  537. },
  538. // === /lobster/prompt → /workflow/lobster/prompt (提示词) ===
  539. [process.env.VUE_APP_BASE_API + '/lobster/prompt']: {
  540. target: 'http://localhost:8006',
  541. changeOrigin: true,
  542. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/prompt']: '/workflow/lobster/prompt' }
  543. },
  544. // === /lobster/api-registry → /workflow/lobster/api-registry (接口注册中心) ===
  545. [process.env.VUE_APP_BASE_API + '/lobster/api-registry']: {
  546. target: 'http://localhost:8006',
  547. changeOrigin: true,
  548. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/api-registry']: '/workflow/lobster/api-registry' }
  549. },
  550. // === /lobster/dead-letter → /workflow/lobster/dead-letter (死信队列) ===
  551. [process.env.VUE_APP_BASE_API + '/lobster/dead-letter']: {
  552. target: 'http://localhost:8006',
  553. changeOrigin: true,
  554. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/dead-letter']: '/workflow/lobster/dead-letter' }
  555. },
  556. // === /lobster/event-audit → /workflow/lobster/event-audit (节点审核) ===
  557. [process.env.VUE_APP_BASE_API + '/lobster/event-audit']: {
  558. target: 'http://localhost:8006',
  559. changeOrigin: true,
  560. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/event-audit']: '/workflow/lobster/event-audit' }
  561. },
  562. // === /lobster/optimization → /workflow/lobster/optimization (AI优化建议) ===
  563. [process.env.VUE_APP_BASE_API + '/lobster/optimization']: {
  564. target: 'http://localhost:8006',
  565. changeOrigin: true,
  566. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/optimization']: '/workflow/lobster/optimization' }
  567. },
  568. // === /lobster/sales-corpus → /workflow/lobster/sales-corpus (销冠语料) ===
  569. [process.env.VUE_APP_BASE_API + '/lobster/sales-corpus']: {
  570. target: 'http://localhost:8006',
  571. changeOrigin: true,
  572. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/sales-corpus']: '/workflow/lobster/sales-corpus' }
  573. },
  574. // === /lobster/model-config → /company/aiProvider (模型配置→AI供应商) ===
  575. [process.env.VUE_APP_BASE_API + '/lobster/model-config']: {
  576. target: 'http://localhost:8006',
  577. changeOrigin: true,
  578. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/model-config']: '/company/aiProvider' }
  579. },
  580. // === /hisStore/storeOrder → /store/storeOrder (商城订单) ===
  581. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrder']: {
  582. target: 'http://localhost:8006',
  583. changeOrigin: true,
  584. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrder']: '/store/storeOrder' }
  585. },
  586. // === /hisStore/storeProduct → /store/storeProduct (商城商品) ===
  587. [process.env.VUE_APP_BASE_API + '/hisStore/storeProduct']: {
  588. target: 'http://localhost:8006',
  589. changeOrigin: true,
  590. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProduct']: '/store/storeProduct' }
  591. },
  592. // === /hisStore/storeProductPackage → /store/storeProductPackage (商品套餐) ===
  593. [process.env.VUE_APP_BASE_API + '/hisStore/storeProductPackage']: {
  594. target: 'http://localhost:8006',
  595. changeOrigin: true,
  596. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProductPackage']: '/store/storeProductPackage' }
  597. },
  598. // === /hisStore/storePayment → /store/storePayment (门店支付) ===
  599. [process.env.VUE_APP_BASE_API + '/hisStore/storePayment']: {
  600. target: 'http://localhost:8006',
  601. changeOrigin: true,
  602. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storePayment']: '/store/storePayment' }
  603. },
  604. // === /hisStore/userOnlineState → /store/userOnlineState (用户在线状态) ===
  605. [process.env.VUE_APP_BASE_API + '/hisStore/userOnlineState']: {
  606. target: 'http://localhost:8006',
  607. changeOrigin: true,
  608. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/userOnlineState']: '/store/userOnlineState' }
  609. },
  610. // === /hisStore/storeProductCategory → /store/storeProductCategory (商品分类) ===
  611. [process.env.VUE_APP_BASE_API + '/hisStore/storeProductCategory']: {
  612. target: 'http://localhost:8006',
  613. changeOrigin: true,
  614. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProductCategory']: '/store/storeProductCategory' }
  615. },
  616. // === /live/liveData → /liveData/liveData (直播数据) ===
  617. [process.env.VUE_APP_BASE_API + '/live/liveData']: {
  618. target: 'http://localhost:8006',
  619. changeOrigin: true,
  620. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveData']: '/liveData/liveData' }
  621. },
  622. // === /live/liveConfig → /live/config (直播配置) ===
  623. [process.env.VUE_APP_BASE_API + '/live/liveConfig']: {
  624. target: 'http://localhost:8006',
  625. changeOrigin: true,
  626. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveConfig']: '/live/config' }
  627. },
  628. // === /live/liveConsole → /live/liveVideo (直播控制台→直播视频) ===
  629. [process.env.VUE_APP_BASE_API + '/live/liveConsole']: {
  630. target: 'http://localhost:8006',
  631. changeOrigin: true,
  632. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveConsole']: '/live/liveVideo' }
  633. },
  634. // === /course/courseAnswerlogs → /course/courseAnswerLog (答题记录) ===
  635. [process.env.VUE_APP_BASE_API + '/course/courseAnswerlogs']: {
  636. target: 'http://localhost:8006',
  637. changeOrigin: true,
  638. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/courseAnswerlogs']: '/course/courseAnswerLog' }
  639. },
  640. // === /course/coursePlaySourceConfig → /course/playSourceConfig (播放源配置) ===
  641. [process.env.VUE_APP_BASE_API + '/course/coursePlaySourceConfig']: {
  642. target: 'http://localhost:8006',
  643. changeOrigin: true,
  644. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/coursePlaySourceConfig']: '/course/playSourceConfig' }
  645. },
  646. // === /course/courseUserStatistics → /course/userWatchStatistics (用户统计) ===
  647. [process.env.VUE_APP_BASE_API + '/course/courseUserStatistics']: {
  648. target: 'http://localhost:8006',
  649. changeOrigin: true,
  650. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/courseUserStatistics']: '/course/userWatchStatistics' }
  651. },
  652. // === /course/category → /course/userCourseCategory (课程分类) ===
  653. [process.env.VUE_APP_BASE_API + '/course/category']: {
  654. target: 'http://localhost:8006',
  655. changeOrigin: true,
  656. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/category']: '/course/userCourseCategory' }
  657. },
  658. // === /hisStore/storeOrderAudit → /store/storeOrderAudit (订单审核) ===
  659. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrderAudit']: {
  660. target: 'http://localhost:8006',
  661. changeOrigin: true,
  662. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrderAudit']: '/hisStore/fsStoreOrderAuditScrm' }
  663. },
  664. // === /hisStore/storeOrderOffline → /hisStore/fsStoreOrderOfflineScrm (线下订单) ===
  665. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrderOffline']: {
  666. target: 'http://localhost:8006',
  667. changeOrigin: true,
  668. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrderOffline']: '/hisStore/fsStoreOrderOfflineScrm' }
  669. },
  670. // === /qw/QwWorkTask/qw/list → /qw/workTask/list (企微任务) ===
  671. [process.env.VUE_APP_BASE_API + '/qw/QwWorkTask/qw']: {
  672. target: 'http://localhost:8006',
  673. changeOrigin: true,
  674. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/QwWorkTask/qw']: '/qw/workTask' }
  675. },
  676. // === /crm/customer/list → /crm/customer/getCustomerList (客户管理) ===
  677. [process.env.VUE_APP_BASE_API + '/crm/customer/list']: {
  678. target: 'http://localhost:8006',
  679. changeOrigin: true,
  680. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/crm/customer/list']: '/crm/customer/getCustomerList' }
  681. },
  682. // watch-api → fs-watch 微服务(需要单独启动 fs-watch)
  683. [process.env.VUE_APP_BASE_API + '/watch-api']: {
  684. target: 'http://localhost:8010',
  685. changeOrigin: true,
  686. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/watch-api']: '' }
  687. },
  688. // ===== 默认所有其他请求 → fs-company(8006) 租户服务端 =====
  689. [process.env.VUE_APP_BASE_API]: {
  690. target: 'http://localhost:8006',
  691. changeOrigin: true,
  692. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' }
  693. }
  694. }
  695. },
  696. configureWebpack: {
  697. name: name,
  698. resolve: {
  699. alias: {
  700. '@': resolve('src')
  701. }
  702. },
  703. externals: {
  704. 'node:async_hooks': 'commonjs async_hooks',
  705. 'node:crypto': 'commonjs crypto',
  706. 'node:fs': 'commonjs fs',
  707. 'node:fs/promises': 'commonjs fs/promises',
  708. 'node:http': 'commonjs http',
  709. 'node:os': 'commonjs os',
  710. 'node:path': 'commonjs path',
  711. 'node:process': 'commonjs process',
  712. 'node:stream': 'commonjs stream',
  713. 'node:stream/web': 'commonjs stream',
  714. 'node:buffer': 'commonjs buffer',
  715. 'node:util': 'commonjs util',
  716. 'node:url': 'commonjs url',
  717. 'node:net': 'commonjs net',
  718. 'node:tls': 'commonjs tls',
  719. 'node:events': 'commonjs events',
  720. 'node:https': 'commonjs https',
  721. 'node:zlib': 'commonjs zlib',
  722. 'node:child_process': 'commonjs child_process'
  723. }
  724. },
  725. chainWebpack(config) {
  726. config.plugins.delete('preload') // TODO: need test
  727. config.plugins.delete('prefetch') // TODO: need test
  728. // set svg-sprite-loader
  729. config.module
  730. .rule('svg')
  731. .exclude.add(resolve('src/assets/icons'))
  732. .end()
  733. config.module
  734. .rule('icons')
  735. .test(/\.svg$/)
  736. .include.add(resolve('src/assets/icons'))
  737. .end()
  738. .use('svg-sprite-loader')
  739. .loader('svg-sprite-loader')
  740. .options({
  741. symbolId: 'icon-[name]'
  742. })
  743. .end()
  744. config
  745. .when(process.env.NODE_ENV !== 'development',
  746. config => {
  747. config
  748. .plugin('ScriptExtHtmlWebpackPlugin')
  749. .after('html')
  750. .use('script-ext-html-webpack-plugin', [{
  751. // `runtime` must same as runtimeChunk name. default is `runtime`
  752. inline: /runtime\..*\.js$/
  753. }])
  754. .end()
  755. config
  756. .optimization.splitChunks({
  757. chunks: 'all',
  758. cacheGroups: {
  759. libs: {
  760. name: 'chunk-libs',
  761. test: /[\\/]node_modules[\\/]/,
  762. priority: 10,
  763. chunks: 'initial' // only package third parties that are initially dependent
  764. },
  765. elementUI: {
  766. name: 'chunk-elementUI', // split elementUI into a single package
  767. priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
  768. test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
  769. },
  770. commons: {
  771. name: 'chunk-commons',
  772. test: resolve('src/components'), // can customize your rules
  773. minChunks: 3, // minimum common number
  774. priority: 5,
  775. reuseExistingChunk: true
  776. }
  777. }
  778. })
  779. config.optimization.runtimeChunk('single'),
  780. {
  781. from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
  782. to: './' //到根目录下
  783. }
  784. }
  785. )
  786. }
  787. }