vue.config.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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-admin(8003)
  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-admin(8003) ===
  145. [process.env.VUE_APP_BASE_API + '/admin/medical']: {
  146. target: 'http://localhost:8003',
  147. changeOrigin: true,
  148. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/admin/medical']: '/admin/medical' }
  149. },
  150. // === /fast_gpt/* → /fastGpt/* ===
  151. [process.env.VUE_APP_BASE_API + '/fast_gpt']: {
  152. target: 'http://localhost:8006',
  153. changeOrigin: true,
  154. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/fast_gpt']: '/fastGpt' }
  155. },
  156. // === /wxSop/sopUserLogsWx → /qwSop/sopUserLogs ===
  157. [process.env.VUE_APP_BASE_API + '/wxSop/sopUserLogsWx']: {
  158. target: 'http://localhost:8006',
  159. changeOrigin: true,
  160. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wxSop/sopUserLogsWx']: '/qwSop/sopUserLogs' }
  161. },
  162. // === /sop/companySopRole → /companySopRole ===
  163. [process.env.VUE_APP_BASE_API + '/sop/companySopRole']: {
  164. target: 'http://localhost:8006',
  165. changeOrigin: true,
  166. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/sop/companySopRole']: '/companySopRole' }
  167. },
  168. // === /company/ 路径无需特殊重写,走全局代理(只去掉 /dev-api 前缀,保留 /company/xxx)===
  169. // === /qw/qwInformation → /qw/information ===
  170. [process.env.VUE_APP_BASE_API + '/qw/qwInformation']: {
  171. target: 'http://localhost:8006',
  172. changeOrigin: true,
  173. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwInformation']: '/qw/information' }
  174. },
  175. // === /qw/qwAppContactWayLogs → /qw/appContactWayLogs ===
  176. [process.env.VUE_APP_BASE_API + '/qw/qwAppContactWayLogs']: {
  177. target: 'http://localhost:8006',
  178. changeOrigin: true,
  179. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwAppContactWayLogs']: '/qw/appContactWayLogs' }
  180. },
  181. // === /qw/qwPushCount → /qw/pushCount ===
  182. [process.env.VUE_APP_BASE_API + '/qw/qwPushCount']: {
  183. target: 'http://localhost:8006',
  184. changeOrigin: true,
  185. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/qwPushCount']: '/qw/pushCount' }
  186. },
  187. // === /qw/records → /qw/record ===
  188. [process.env.VUE_APP_BASE_API + '/qw/records']: {
  189. target: 'http://localhost:8006',
  190. changeOrigin: true,
  191. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/records']: '/qw/record' }
  192. },
  193. // === /qw/workLinkUser → /qw/workLink ===
  194. [process.env.VUE_APP_BASE_API + '/qw/workLinkUser']: {
  195. target: 'http://localhost:8006',
  196. changeOrigin: true,
  197. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/workLinkUser']: '/qw/workLink' }
  198. },
  199. // === /qw/workUser → /qw/work ===
  200. [process.env.VUE_APP_BASE_API + '/qw/workUser']: {
  201. target: 'http://localhost:8006',
  202. changeOrigin: true,
  203. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/workUser']: '/qw/work' }
  204. },
  205. // === /qw/analyze → /qw/analyze (直接透传) ===
  206. // === /qw/customerProperty → /qw/customerProperty (直接透传) ===
  207. // === /crm/assist → /crm/assist (直接透传) ===
  208. // === /crm/analyze → /crm/analyze (直接透传) ===
  209. // === /crm/third → /crm/third (直接透传) ===
  210. // === /crm/event → /crm/event (直接透传) ===
  211. // === /crm/report → /crm/report (直接透传) ===
  212. // === /crm/customerHisOrder → /crm/customerHisOrder (直接透传) ===
  213. // === /crm/msg → /crm/msg (直接透传) ===
  214. // === /his/aiWorkflow → /his/aiWorkflow (直接透传) ===
  215. // his/fsXxx → store/xxx(saasadminui 用 his/fs 前缀,后端用 store)
  216. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrder']: {
  217. target: 'http://localhost:8006',
  218. changeOrigin: true,
  219. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrder']: '/store/storeOrder' }
  220. },
  221. [process.env.VUE_APP_BASE_API + '/his/fsInquiryOrderReport']: {
  222. target: 'http://localhost:8006',
  223. changeOrigin: true,
  224. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsInquiryOrderReport']: '/store/inquiryOrderReport' }
  225. },
  226. [process.env.VUE_APP_BASE_API + '/his/fsInquiryOrder']: {
  227. target: 'http://localhost:8006',
  228. changeOrigin: true,
  229. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsInquiryOrder']: '/store/inquiryOrder' }
  230. },
  231. [process.env.VUE_APP_BASE_API + '/his/fsDrugReportCount']: {
  232. target: 'http://localhost:8006',
  233. changeOrigin: true,
  234. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsDrugReportCount']: '/store/drugReportCount' }
  235. },
  236. [process.env.VUE_APP_BASE_API + '/his/fsDrugReport']: {
  237. target: 'http://localhost:8006',
  238. changeOrigin: true,
  239. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsDrugReport']: '/store/drugReport' }
  240. },
  241. [process.env.VUE_APP_BASE_API + '/his/fsHealthData']: {
  242. target: 'http://localhost:8006',
  243. changeOrigin: true,
  244. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsHealthData']: '/store/healthData' }
  245. },
  246. [process.env.VUE_APP_BASE_API + '/his/fsHealthRecord']: {
  247. target: 'http://localhost:8006',
  248. changeOrigin: true,
  249. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsHealthRecord']: '/store/healthRecord' }
  250. },
  251. [process.env.VUE_APP_BASE_API + '/his/fsUserOnlineState']: {
  252. target: 'http://localhost:8006',
  253. changeOrigin: true,
  254. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserOnlineState']: '/store/userOnlineState' }
  255. },
  256. [process.env.VUE_APP_BASE_API + '/his/fsUserCoupon']: {
  257. target: 'http://localhost:8006',
  258. changeOrigin: true,
  259. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserCoupon']: '/store/userCoupon' }
  260. },
  261. [process.env.VUE_APP_BASE_API + '/his/fsUserAddress']: {
  262. target: 'http://localhost:8006',
  263. changeOrigin: true,
  264. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUserAddress']: '/store/userAddress' }
  265. },
  266. [process.env.VUE_APP_BASE_API + '/his/fsUser']: {
  267. target: 'http://localhost:8006',
  268. changeOrigin: true,
  269. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsUser']: '/store/user' }
  270. },
  271. [process.env.VUE_APP_BASE_API + '/his/fsMaterialGroup']: {
  272. target: 'http://localhost:8006',
  273. changeOrigin: true,
  274. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsMaterialGroup']: '/store/materialGroup' }
  275. },
  276. [process.env.VUE_APP_BASE_API + '/his/fsMaterial']: {
  277. target: 'http://localhost:8006',
  278. changeOrigin: true,
  279. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsMaterial']: '/store/material' }
  280. },
  281. [process.env.VUE_APP_BASE_API + '/his/fsExportTask']: {
  282. target: 'http://localhost:8006',
  283. changeOrigin: true,
  284. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsExportTask']: '/store/exportTask' }
  285. },
  286. [process.env.VUE_APP_BASE_API + '/his/fsCoupon']: {
  287. target: 'http://localhost:8006',
  288. changeOrigin: true,
  289. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCoupon']: '/store/coupon' }
  290. },
  291. [process.env.VUE_APP_BASE_API + '/his/fsPatient']: {
  292. target: 'http://localhost:8006',
  293. changeOrigin: true,
  294. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPatient']: '/store/patient' }
  295. },
  296. [process.env.VUE_APP_BASE_API + '/his/fsPackage']: {
  297. target: 'http://localhost:8006',
  298. changeOrigin: true,
  299. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPackage']: '/store/package' }
  300. },
  301. [process.env.VUE_APP_BASE_API + '/his/fsStoreProductCategory']: {
  302. target: 'http://localhost:8006',
  303. changeOrigin: true,
  304. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreProductCategory']: '/store/storeProductCategory' }
  305. },
  306. [process.env.VUE_APP_BASE_API + '/his/fsStoreProduct']: {
  307. target: 'http://localhost:8006',
  308. changeOrigin: true,
  309. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreProduct']: '/store/storeProduct' }
  310. },
  311. [process.env.VUE_APP_BASE_API + '/his/fsStoreAfterSales']: {
  312. target: 'http://localhost:8006',
  313. changeOrigin: true,
  314. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreAfterSales']: '/store/storeAfterSales' }
  315. },
  316. [process.env.VUE_APP_BASE_API + '/his/fsPayment']: {
  317. target: 'http://localhost:8006',
  318. changeOrigin: true,
  319. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPayment']: '/store/storePayment' }
  320. },
  321. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderOffline']: {
  322. target: 'http://localhost:8006',
  323. changeOrigin: true,
  324. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderOffline']: '/hisStore/fsStoreOrderOfflineScrm' }
  325. },
  326. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderAudit']: {
  327. target: 'http://localhost:8006',
  328. changeOrigin: true,
  329. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderAudit']: '/hisStore/fsStoreOrderAuditScrm' }
  330. },
  331. [process.env.VUE_APP_BASE_API + '/his/fsStoreOrderBillLog']: {
  332. target: 'http://localhost:8006',
  333. changeOrigin: true,
  334. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreOrderBillLog']: '/bill/billLog' }
  335. },
  336. [process.env.VUE_APP_BASE_API + '/his/fsStoreStatistics']: {
  337. target: 'http://localhost:8006',
  338. changeOrigin: true,
  339. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsStoreStatistics']: '/hisStore/fsStoreStatisticsScrm' }
  340. },
  341. [process.env.VUE_APP_BASE_API + '/his/fsIcd']: {
  342. target: 'http://localhost:8006',
  343. changeOrigin: true,
  344. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsIcd']: '/store/icd' }
  345. },
  346. [process.env.VUE_APP_BASE_API + '/his/fsPrescribe']: {
  347. target: 'http://localhost:8006',
  348. changeOrigin: true,
  349. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsPrescribe']: '/store/prescribe' }
  350. },
  351. [process.env.VUE_APP_BASE_API + '/his/fsFollowTemp']: {
  352. target: 'http://localhost:8006',
  353. changeOrigin: true,
  354. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsFollowTemp']: '/store/followTemp' }
  355. },
  356. [process.env.VUE_APP_BASE_API + '/his/fsCollectionSchedule']: {
  357. target: 'http://localhost:8006',
  358. changeOrigin: true,
  359. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCollectionSchedule']: '/store/collectionSchedule' }
  360. },
  361. [process.env.VUE_APP_BASE_API + '/his/fsCollection']: {
  362. target: 'http://localhost:8006',
  363. changeOrigin: true,
  364. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsCollection']: '/store/collection' }
  365. },
  366. // his/fsFirstDiagnosis → his/diagnosis
  367. [process.env.VUE_APP_BASE_API + '/his/fsFirstDiagnosis']: {
  368. target: 'http://localhost:8006',
  369. changeOrigin: true,
  370. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/his/fsFirstDiagnosis']: '/his/diagnosis' }
  371. },
  372. // hisStore/collection → store/collection
  373. [process.env.VUE_APP_BASE_API + '/hisStore/collection']: {
  374. target: 'http://localhost:8006',
  375. changeOrigin: true,
  376. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/collection']: '/store/collection' }
  377. },
  378. // wx/wxSop* → qwSop/sopUserLogs* (企微SOP)
  379. [process.env.VUE_APP_BASE_API + '/wx/wxSopUserInfo']: {
  380. target: 'http://localhost:8006',
  381. changeOrigin: true,
  382. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopUserInfo']: '/qwSop/sopUserLogsInfo' }
  383. },
  384. [process.env.VUE_APP_BASE_API + '/wx/wxSopUser']: {
  385. target: 'http://localhost:8006',
  386. changeOrigin: true,
  387. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopUser']: '/qwSop/sopUserLogs' }
  388. },
  389. [process.env.VUE_APP_BASE_API + '/wx/wxSopLogs']: {
  390. target: 'http://localhost:8006',
  391. changeOrigin: true,
  392. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSopLogs']: '/qwSop/sopUserLogsInfo' }
  393. },
  394. [process.env.VUE_APP_BASE_API + '/wx/wxSop']: {
  395. target: 'http://localhost:8006',
  396. changeOrigin: true,
  397. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/wx/wxSop']: '/qwSop/sopUserLogs' }
  398. },
  399. // === /live/coupon → /live/coupon (直接透传,后端已有) ===
  400. // === /live/liveLotteryProductConf → /live/liveLotteryProductConf (直接透传) ===
  401. // === /live/liveAfterSalesLogs → /live/liveAfterSalesLogs (直接透传) ===
  402. // === /live/liveEventConf → /live/liveEventConf (直接透传) ===
  403. // === /live/liveOrderStatus → /live/liveOrderStatus (直接透传) ===
  404. // === /live/liveUserRedRecord → /live/liveUserRedRecord (直接透传) ===
  405. // === /live/trafficLog → /live/trafficLog (直接透传) ===
  406. // === /live/comment → /live/comment (直接透传) ===
  407. // === /course/userVideoComment → /course/userVideoComment (直接透传) ===
  408. // === /course/userCourseComment → /course/userCourseComment (直接透传) ===
  409. // === /course/userCourseNote → /course/userCourseNote (直接透传) ===
  410. // === /course/userCourseStudy → /course/userCourseStudy (直接透传) ===
  411. // === /course/userTalent → /course/userTalent (直接透传) ===
  412. // === /course/statistics → /course/statistics (直接透传) ===
  413. // === /course/courseQuestionCategory → /course/courseQuestionCategory (直接透传) ===
  414. // === /course/fsCourseProduct → /course/fsCourseProduct (直接透传) ===
  415. // === /course/fsUserCoursePeriodDays → /course/fsUserCoursePeriodDays (直接透传) ===
  416. // === /course/courseWatchComment → /course/courseWatchComment (直接透传) ===
  417. // === /course/videoTags → /course/videoTags (直接透传) ===
  418. // === /course/videoResource → /course/videoResource (直接透传) ===
  419. // === /his/patient → /his/patient (直接透传) ===
  420. // === /his/store → /his/store (直接透传) ===
  421. // === /his/coupon → /his/coupon (直接透传) ===
  422. // === /his/doctorBill → /his/doctorBill (直接透传) ===
  423. // === /his/storeBill → /his/storeBill (直接透传) ===
  424. // === /his/storeLog → /his/storeLog (直接透传) ===
  425. // === /his/storeExtract → /his/storeExtract (直接透传) ===
  426. // === /his/storeSubOrder → /his/storeSubOrder (直接透传) ===
  427. // === /his/storeAfterSales → /his/storeAfterSales (直接透传) ===
  428. // === /his/storeProduct → /his/storeProduct (直接透传) ===
  429. // === /his/storeProductPackage → /his/storeProductPackage (直接透传) ===
  430. // === /his/storeActivity → /his/storeActivity (直接透传) ===
  431. // === /his/storeOrder → /his/storeOrder (直接透传) ===
  432. // === /his/user → /his/user (直接透传) ===
  433. // === /his/userBill → /his/userBill (直接透传) ===
  434. // === /his/userExtract → /his/userExtract (直接透传) ===
  435. // === /his/userRecharge → /his/userRecharge (直接透传) ===
  436. // === /his/userIntegralLogs → /his/userIntegralLogs (直接透传) ===
  437. // === /his/companyRecharge → /his/companyRecharge (直接透传) ===
  438. // === /his/companyDeduct → /his/companyDeduct (直接透传) ===
  439. // === /his/company → /his/company (直接透传) ===
  440. // === /his/doctorExtract → /his/doctorExtract (直接透传) ===
  441. // === /his/doctorArticle → /his/doctorArticle (直接透传) ===
  442. // === /his/doctorArticleCate → /his/doctorArticleCate (直接透传) ===
  443. // === /his/doctorOperLog → /his/doctorOperLog (直接透传) ===
  444. // === /his/doctorPrescribeDrug → /his/doctorPrescribeDrug (直接透传) ===
  445. // === /his/doctorPrescribe → /his/doctorPrescribe (直接透传) ===
  446. // === /his/doctorProduct → /his/doctorProduct (直接透传) ===
  447. // === /his/disease → /his/disease (直接透传) ===
  448. // === /his/illnessLibrary → /his/illnessLibrary (直接透传) ===
  449. // === /his/inquiryDisease → /his/inquiryDisease (直接透传) ===
  450. // === /his/inquiryOrderPing → /his/inquiryOrderPing (直接透传) ===
  451. // === /his/inquiryTemp → /his/inquiryTemp (直接透传) ===
  452. // === /his/hospital → /his/hospital (直接透传) ===
  453. // === /his/department → /his/department (直接透传) ===
  454. // === /his/vessel → /his/vessel (直接透传) ===
  455. // === /his/chineseMedicine → /his/chineseMedicine (直接透传) ===
  456. // === /his/famousPrescribe → /his/famousPrescribe (直接透传) ===
  457. // === /his/medicatedFood → /his/medicatedFood (直接透传) ===
  458. // === /his/healthLife → /his/healthLife (直接透传) ===
  459. // === /his/healthHistoryTemp → /his/healthHistoryTemp (直接透传) ===
  460. // === /his/physicalReportTemplate → /his/physicalReportTemplate (直接透传) ===
  461. // === /his/physicalReportTemplateField → /his/physicalReportTemplateField (直接透传) ===
  462. // === /his/testReport → /his/testReport (直接透传) ===
  463. // === /his/testTemp → /his/testTemp (直接透传) ===
  464. // === /his/testTempItem → /his/testTempItem (直接透传) ===
  465. // === /his/template → /his/template (直接透传) ===
  466. // === /his/questions → /his/questions (直接透传) ===
  467. // === /his/answer → /his/answer (直接透传) ===
  468. // === /his/packageCate → /his/packageCate (直接透传) ===
  469. // === /his/packageSolarTerm → /his/packageSolarTerm (直接透传) ===
  470. // === /his/packageFavorite → /his/packageFavorite (直接透传) ===
  471. // === /his/packageOrder → /his/packageOrder (直接透传) ===
  472. // === /his/dfAccount → /his/dfAccount (直接透传) ===
  473. // === /his/hfpayConfig → /his/hfpayConfig (直接透传) ===
  474. // === /his/doctorAdvice → /his/doctorAdvice (直接透传) ===
  475. // === /his/homeView → /his/homeView (直接透传) ===
  476. // === /his/homeArticle → /his/homeArticle (直接透传) ===
  477. // === /his/homeCategory → /his/homeCategory (直接透传) ===
  478. // === /his/articleCate → /his/articleCate (直接透传) ===
  479. // === /his/articleViews → /his/articleViews (直接透传) ===
  480. // === /his/caseArticle → /his/caseArticle (直接透传) ===
  481. // === /his/adv → /his/adv (直接透传) ===
  482. // === /his/price → /his/price (直接透传) ===
  483. // === /his/appVersion → /his/appVersion (直接透传) ===
  484. // === /his/express → /his/express (直接透传) ===
  485. // === /his/userAddress → /his/userAddress (直接透传) ===
  486. // === /his/userCoupon → /his/userCoupon (直接透传) ===
  487. // === /his/merchantAppConfig → /his/merchantAppConfig (直接透传) ===
  488. // === /his/pharmacist → /his/pharmacist (直接透传) ===
  489. // === /his/complaint → /his/complaint (直接透传) ===
  490. // === /his/healthArticle → /his/healthArticle (直接透传) ===
  491. // === /his/promotionActive → /his/promotionActive (直接透传) ===
  492. // === /his/promotionActiveLog → /his/promotionActiveLog (直接透传) ===
  493. // === /his/logs → /his/logs (直接透传) ===
  494. // === /his/userNewTask → /his/userNewTask (直接透传) ===
  495. // === /his/divItem → /his/divItem (直接透传) ===
  496. // === /his/icd → /his/icd (直接透传) ===
  497. // === /his/aiWorkflow → /his/aiWorkflow (直接透传) ===
  498. // === /his/healthData → /his/healthData (直接透传) ===
  499. // === /his/inquiryOrder → /his/inquiryOrder (直接透传) ===
  500. // === /his/drugReportCount → /his/drugReportCount (直接透传) ===
  501. // === /his/doctor → /his/doctor (直接透传) ===
  502. // === /his/prescription → /his/prescription (直接透传) ===
  503. // === /his/drugReport → /his/drugReport (直接透传) ===
  504. // === /his/exportTask → /his/exportTask (直接透传) ===
  505. // === /his/healthTongue → /his/healthTongue (直接透传) ===
  506. // === /his/healthRecord → /his/healthRecord (直接透传) ===
  507. // === /his/diagnosis → /his/diagnosis (直接透传) ===
  508. // === /his/healthRecordTemplate → /his/healthRecordTemplate (直接透传) ===
  509. // === /his/healthTongueQuestion → /his/healthTongueQuestion (直接透传) ===
  510. // === /his/followPlan → /his/followPlan (直接透传) ===
  511. // === /his/recoveryRecord → /his/recoveryRecord (直接透传) ===
  512. // === /his/recoveryPlan → /his/recoveryPlan (直接透传) ===
  513. // === /his/healthReport → /his/healthReport (直接透传) ===
  514. // === /his/inquiryOrderReport → /his/inquiryOrderReport (直接透传) ===
  515. // === /his/inquiryDisease → /his/inquiryDisease (直接透传) ===
  516. // === /his/integralGoods → /his/integralGoods (直接透传) ===
  517. // === /his/integralOrder → /his/integralOrder (直接透传) ===
  518. // === /his/redPacket → /his/redPacket (直接透传) ===
  519. // === /company/wxAccount → /company/wxUser (微信账号) ===
  520. [process.env.VUE_APP_BASE_API + '/company/wxAccount']: {
  521. target: 'http://localhost:8006',
  522. changeOrigin: true,
  523. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/company/wxAccount']: '/company/wxUser' }
  524. },
  525. // === /user/darkRoom → /store/user/darkRoomList (小黑屋) ===
  526. [process.env.VUE_APP_BASE_API + '/user/darkRoom']: {
  527. target: 'http://localhost:8006',
  528. changeOrigin: true,
  529. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/user/darkRoom']: '/store/user/darkRoomList' }
  530. },
  531. // === /user/transfer → /system/approval (转接管理) ===
  532. [process.env.VUE_APP_BASE_API + '/user/transfer']: {
  533. target: 'http://localhost:8006',
  534. changeOrigin: true,
  535. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/user/transfer']: '/system/approval' }
  536. },
  537. // === /lobster/billing → /workflow/lobster/billing (龙虾计费) ===
  538. [process.env.VUE_APP_BASE_API + '/lobster/billing']: {
  539. target: 'http://localhost:8006',
  540. changeOrigin: true,
  541. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/billing']: '/workflow/lobster/billing' }
  542. },
  543. // === /lobster/prompt → /workflow/lobster/prompt (提示词) ===
  544. [process.env.VUE_APP_BASE_API + '/lobster/prompt']: {
  545. target: 'http://localhost:8006',
  546. changeOrigin: true,
  547. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/prompt']: '/workflow/lobster/prompt' }
  548. },
  549. // === /lobster/api-registry → /workflow/lobster/api-registry (接口注册中心) ===
  550. [process.env.VUE_APP_BASE_API + '/lobster/api-registry']: {
  551. target: 'http://localhost:8006',
  552. changeOrigin: true,
  553. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/api-registry']: '/workflow/lobster/api-registry' }
  554. },
  555. // === /lobster/dead-letter → /workflow/lobster/dead-letter (死信队列) ===
  556. [process.env.VUE_APP_BASE_API + '/lobster/dead-letter']: {
  557. target: 'http://localhost:8006',
  558. changeOrigin: true,
  559. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/dead-letter']: '/workflow/lobster/dead-letter' }
  560. },
  561. // === /lobster/event-audit → /workflow/lobster/event-audit (节点审核) ===
  562. [process.env.VUE_APP_BASE_API + '/lobster/event-audit']: {
  563. target: 'http://localhost:8006',
  564. changeOrigin: true,
  565. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/event-audit']: '/workflow/lobster/event-audit' }
  566. },
  567. // === /lobster/optimization → /workflow/lobster/optimization (AI优化建议) ===
  568. [process.env.VUE_APP_BASE_API + '/lobster/optimization']: {
  569. target: 'http://localhost:8006',
  570. changeOrigin: true,
  571. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/optimization']: '/workflow/lobster/optimization' }
  572. },
  573. // === /lobster/sales-corpus → /workflow/lobster/sales-corpus (销冠语料) ===
  574. [process.env.VUE_APP_BASE_API + '/lobster/sales-corpus']: {
  575. target: 'http://localhost:8006',
  576. changeOrigin: true,
  577. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/sales-corpus']: '/workflow/lobster/sales-corpus' }
  578. },
  579. // === /lobster/model-config → /company/aiProvider (模型配置→AI供应商) ===
  580. [process.env.VUE_APP_BASE_API + '/lobster/model-config']: {
  581. target: 'http://localhost:8006',
  582. changeOrigin: true,
  583. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/lobster/model-config']: '/company/aiProvider' }
  584. },
  585. // === /hisStore/storeOrder → /store/storeOrder (商城订单) ===
  586. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrder']: {
  587. target: 'http://localhost:8006',
  588. changeOrigin: true,
  589. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrder']: '/store/storeOrder' }
  590. },
  591. // === /hisStore/storeProduct → /store/storeProduct (商城商品) ===
  592. [process.env.VUE_APP_BASE_API + '/hisStore/storeProduct']: {
  593. target: 'http://localhost:8006',
  594. changeOrigin: true,
  595. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProduct']: '/store/storeProduct' }
  596. },
  597. // === /hisStore/storeProductPackage → /store/storeProductPackage (商品套餐) ===
  598. [process.env.VUE_APP_BASE_API + '/hisStore/storeProductPackage']: {
  599. target: 'http://localhost:8006',
  600. changeOrigin: true,
  601. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProductPackage']: '/store/storeProductPackage' }
  602. },
  603. // === /hisStore/storePayment → /store/storePayment (门店支付) ===
  604. [process.env.VUE_APP_BASE_API + '/hisStore/storePayment']: {
  605. target: 'http://localhost:8006',
  606. changeOrigin: true,
  607. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storePayment']: '/store/storePayment' }
  608. },
  609. // === /hisStore/userOnlineState → /store/userOnlineState (用户在线状态) ===
  610. [process.env.VUE_APP_BASE_API + '/hisStore/userOnlineState']: {
  611. target: 'http://localhost:8006',
  612. changeOrigin: true,
  613. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/userOnlineState']: '/store/userOnlineState' }
  614. },
  615. // === /hisStore/storeProductCategory → /store/storeProductCategory (商品分类) ===
  616. [process.env.VUE_APP_BASE_API + '/hisStore/storeProductCategory']: {
  617. target: 'http://localhost:8006',
  618. changeOrigin: true,
  619. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeProductCategory']: '/store/storeProductCategory' }
  620. },
  621. // === /live/liveData → /liveData/liveData (直播数据) ===
  622. [process.env.VUE_APP_BASE_API + '/live/liveData']: {
  623. target: 'http://localhost:8006',
  624. changeOrigin: true,
  625. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveData']: '/liveData/liveData' }
  626. },
  627. // === /live/liveConfig → /live/config (直播配置) ===
  628. [process.env.VUE_APP_BASE_API + '/live/liveConfig']: {
  629. target: 'http://localhost:8006',
  630. changeOrigin: true,
  631. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveConfig']: '/live/config' }
  632. },
  633. // === /live/liveConsole → /live/liveVideo (直播控制台→直播视频) ===
  634. [process.env.VUE_APP_BASE_API + '/live/liveConsole']: {
  635. target: 'http://localhost:8006',
  636. changeOrigin: true,
  637. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/live/liveConsole']: '/live/liveVideo' }
  638. },
  639. // === /course/courseAnswerlogs → /course/courseAnswerLog (答题记录) ===
  640. [process.env.VUE_APP_BASE_API + '/course/courseAnswerlogs']: {
  641. target: 'http://localhost:8006',
  642. changeOrigin: true,
  643. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/courseAnswerlogs']: '/course/courseAnswerLog' }
  644. },
  645. // === /course/coursePlaySourceConfig → /course/playSourceConfig (播放源配置) ===
  646. [process.env.VUE_APP_BASE_API + '/course/coursePlaySourceConfig']: {
  647. target: 'http://localhost:8006',
  648. changeOrigin: true,
  649. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/coursePlaySourceConfig']: '/course/playSourceConfig' }
  650. },
  651. // === /course/courseUserStatistics → /course/userWatchStatistics (用户统计) ===
  652. [process.env.VUE_APP_BASE_API + '/course/courseUserStatistics']: {
  653. target: 'http://localhost:8006',
  654. changeOrigin: true,
  655. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/courseUserStatistics']: '/course/userWatchStatistics' }
  656. },
  657. // === /course/category → /course/userCourseCategory (课程分类) ===
  658. [process.env.VUE_APP_BASE_API + '/course/category']: {
  659. target: 'http://localhost:8006',
  660. changeOrigin: true,
  661. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/course/category']: '/course/userCourseCategory' }
  662. },
  663. // === /hisStore/storeOrderAudit → /store/storeOrderAudit (订单审核) ===
  664. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrderAudit']: {
  665. target: 'http://localhost:8006',
  666. changeOrigin: true,
  667. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrderAudit']: '/hisStore/fsStoreOrderAuditScrm' }
  668. },
  669. // === /hisStore/storeOrderOffline → /hisStore/fsStoreOrderOfflineScrm (线下订单) ===
  670. [process.env.VUE_APP_BASE_API + '/hisStore/storeOrderOffline']: {
  671. target: 'http://localhost:8006',
  672. changeOrigin: true,
  673. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/hisStore/storeOrderOffline']: '/hisStore/fsStoreOrderOfflineScrm' }
  674. },
  675. // === /qw/QwWorkTask/qw/list → /qw/workTask/list (企微任务) ===
  676. [process.env.VUE_APP_BASE_API + '/qw/QwWorkTask/qw']: {
  677. target: 'http://localhost:8006',
  678. changeOrigin: true,
  679. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/qw/QwWorkTask/qw']: '/qw/workTask' }
  680. },
  681. // === /crm/customer/list → /crm/customer/getCustomerList (客户管理) ===
  682. [process.env.VUE_APP_BASE_API + '/crm/customer/list']: {
  683. target: 'http://localhost:8006',
  684. changeOrigin: true,
  685. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/crm/customer/list']: '/crm/customer/getCustomerList' }
  686. },
  687. // watch-api → fs-watch 微服务(需要单独启动 fs-watch)
  688. [process.env.VUE_APP_BASE_API + '/watch-api']: {
  689. target: 'http://localhost:8010',
  690. changeOrigin: true,
  691. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API + '/watch-api']: '' }
  692. },
  693. // ===== 默认所有其他请求 → fs-company(8006) 租户服务端 =====
  694. [process.env.VUE_APP_BASE_API]: {
  695. target: 'http://localhost:8006',
  696. changeOrigin: true,
  697. pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' }
  698. }
  699. }
  700. },
  701. configureWebpack: {
  702. name: name,
  703. resolve: {
  704. alias: {
  705. '@': resolve('src')
  706. }
  707. },
  708. externals: {
  709. 'node:async_hooks': 'commonjs async_hooks',
  710. 'node:crypto': 'commonjs crypto',
  711. 'node:fs': 'commonjs fs',
  712. 'node:fs/promises': 'commonjs fs/promises',
  713. 'node:http': 'commonjs http',
  714. 'node:os': 'commonjs os',
  715. 'node:path': 'commonjs path',
  716. 'node:process': 'commonjs process',
  717. 'node:stream': 'commonjs stream',
  718. 'node:stream/web': 'commonjs stream',
  719. 'node:buffer': 'commonjs buffer',
  720. 'node:util': 'commonjs util',
  721. 'node:url': 'commonjs url',
  722. 'node:net': 'commonjs net',
  723. 'node:tls': 'commonjs tls',
  724. 'node:events': 'commonjs events',
  725. 'node:https': 'commonjs https',
  726. 'node:zlib': 'commonjs zlib',
  727. 'node:child_process': 'commonjs child_process'
  728. }
  729. },
  730. chainWebpack(config) {
  731. config.plugins.delete('preload') // TODO: need test
  732. config.plugins.delete('prefetch') // TODO: need test
  733. // set svg-sprite-loader
  734. config.module
  735. .rule('svg')
  736. .exclude.add(resolve('src/assets/icons'))
  737. .end()
  738. config.module
  739. .rule('icons')
  740. .test(/\.svg$/)
  741. .include.add(resolve('src/assets/icons'))
  742. .end()
  743. .use('svg-sprite-loader')
  744. .loader('svg-sprite-loader')
  745. .options({
  746. symbolId: 'icon-[name]'
  747. })
  748. .end()
  749. config
  750. .when(process.env.NODE_ENV !== 'development',
  751. config => {
  752. config
  753. .plugin('ScriptExtHtmlWebpackPlugin')
  754. .after('html')
  755. .use('script-ext-html-webpack-plugin', [{
  756. // `runtime` must same as runtimeChunk name. default is `runtime`
  757. inline: /runtime\..*\.js$/
  758. }])
  759. .end()
  760. config
  761. .optimization.splitChunks({
  762. chunks: 'all',
  763. cacheGroups: {
  764. libs: {
  765. name: 'chunk-libs',
  766. test: /[\\/]node_modules[\\/]/,
  767. priority: 10,
  768. chunks: 'initial' // only package third parties that are initially dependent
  769. },
  770. elementUI: {
  771. name: 'chunk-elementUI', // split elementUI into a single package
  772. priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
  773. test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
  774. },
  775. commons: {
  776. name: 'chunk-commons',
  777. test: resolve('src/components'), // can customize your rules
  778. minChunks: 3, // minimum common number
  779. priority: 5,
  780. reuseExistingChunk: true
  781. }
  782. }
  783. })
  784. config.optimization.runtimeChunk('single'),
  785. {
  786. from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
  787. to: './' //到根目录下
  788. }
  789. }
  790. )
  791. }
  792. }