.umirc.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // ref: https://umijs.org/config/
  2. import pxToViewPort from 'postcss-px-to-viewport';
  3. const extraPostCSSPlugins = [
  4. pxToViewPort({
  5. viewportWidth: 750,
  6. unitPrecision: 5,
  7. viewportUnit: 'vw',
  8. fontViewportUnit: 'vw',
  9. selectorBlackList: [],
  10. minPixelValue: 1,
  11. mediaQuery: true
  12. })
  13. ]
  14. export default {
  15. extraPostCSSPlugins,
  16. treeShaking: true,
  17. routes: [
  18. { path: '/', redirect: '/catchdolphins' },
  19. {
  20. path: '/',
  21. component: '../layouts/index',
  22. routes: [
  23. //抢头条活动
  24. { path: '/headlines', component: '../pages/Headlines', name: '抢头条' },
  25. { path: '/headscreen', component: '../pages/headScreen', name: '抢头条' },
  26. //抢海豚
  27. { path: '/catchdolphins', component: '../pages/Catchdolphins/Catchdolphins', name: '抢海豚' },
  28. //七夕活动--2021-8-14
  29. { path: '/loveDay', component: '../pages/Loveday/Loveday', name: '甜蜜七夕' },
  30. { path: '/loveDay/rule', component: '../pages/Loveday/Loverule', name: '规则说明' },
  31. { path: '/loveDay/list', component: '../pages/Loveday/Lovelist', name: '心动列表' },
  32. //中秋活动
  33. { path: '/middleautumn', component: '../pages/Middleautumn', name: '浓情中秋' }
  34. ]
  35. }
  36. ],
  37. plugins: [
  38. // ref: https://umijs.org/plugin/umi-plugin-react.html
  39. ['umi-plugin-react', {
  40. antd: false,
  41. dva: true,
  42. dynamicImport: false,
  43. dll: false,
  44. hd: {
  45. "theme": {
  46. "hd": "2px",
  47. },
  48. // "px2rem": {
  49. // "rootValue": 100,
  50. // "unitPrecision": 5,
  51. // "propWhiteList": [],
  52. // "propBlackList": [],
  53. // "exclude": false,
  54. // "selectorBlackList": [],
  55. // "ignoreIdentifier": false,
  56. // "replace": true,
  57. // "mediaQuery": false,
  58. // "minPixelValue": 0
  59. // }
  60. },
  61. locale: {
  62. default: 'zh-CN', //默认语言 zh-CN,如果 baseSeparator 设置为 _,则默认为 zh_CN
  63. baseNavigator: true, // 为true时,用navigator.language的值作为默认语言
  64. antd: true, // 是否启用antd的<LocaleProvider />
  65. baseSeparator: '-', // 语言默认分割符 -
  66. },
  67. routes: {
  68. exclude: [
  69. /models\//,
  70. /services\//,
  71. /model\.(t|j)sx?$/,
  72. /service\.(t|j)sx?$/,
  73. /components\//,
  74. ],
  75. },
  76. publicPath: '/',
  77. //CDN引入
  78. links: [
  79. { href: 'http://sp.qn.panygo.com/static/antd-mobile/2.3.1/antd-mobile.min.css', rel: 'stylesheet' }
  80. ],
  81. headScripts: [
  82. //react
  83. 'http://sp.qn.panygo.com/static/react/16.9.0/react.production.min.js',
  84. //react-dom
  85. 'http://sp.qn.panygo.com/static/react/16.9.0/react-dom.production.min.js',
  86. //antd-mobile
  87. 'http://sp.qn.panygo.com/static/antd-mobile/2.3.1/antd-mobile.min.js',
  88. //lottie动画
  89. 'http://sp.qn.panygo.com/static/bodymovin/5.6.8/lottie.min.js',
  90. //moment
  91. 'http://sp.qn.panygo.com/static/moment/2.24.0/moment.min.js',
  92. //UAParser
  93. 'http://sp.qn.panygo.com/static/UAParser/0.7.21/ua-parser.min.js'
  94. ]
  95. }]
  96. ],
  97. lessLoaderOptions: {
  98. javascriptEnabled: true,
  99. },
  100. extraBabelPlugins: [
  101. ["import", { libraryName: "antd-mobile", style: true }] // `style: true` 会加载 less 文件
  102. ],
  103. proxy: {
  104. '/api-app': {
  105. // target: 'http://api.timichat.net',
  106. target: 'http://localhost:9201',
  107. changeOrigin: true,
  108. //pathRewrite: { '^/server': '' },
  109. },
  110. '/api-common': {
  111. // target: 'http://api.starbuds.laylib.com',
  112. target: 'http://localhost:9230',
  113. changeOrigin: true,
  114. //pathRewrite: { '^/server': '' },
  115. },
  116. },
  117. hash: true,
  118. outputPath: './srank',
  119. externals: {
  120. 'react': 'React',
  121. 'react-dom': 'ReactDOM',
  122. 'antd-mobile': 'antd-mobile',
  123. 'lottie-web': 'lottie',
  124. 'moment': 'moment',
  125. 'ua-parser-js': 'UAParser'
  126. },
  127. define: {
  128. 'process.env': process.env
  129. }
  130. }