config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import defaultSettings from './defaultSettings'; // https://umijs.org/config/
  2. import { chainWebpack } from './plugin.config'
  3. import slash from 'slash2';
  4. import themePluginConfig from './themePluginConfig';
  5. // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
  6. import { routerConfig } from './routerConfig.js';
  7. import { defineConfig } from 'umi';
  8. const autoprefixer = require('autoprefixer')
  9. const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
  10. const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
  11. export default defineConfig({
  12. antd: {},
  13. dva: {
  14. hmr: true,
  15. },
  16. locale: {
  17. // default zh-CN
  18. default: 'zh-CN',
  19. antd: true,
  20. // default true, when it is true, will use `navigator.language` overwrite default
  21. baseNavigator: true,
  22. },
  23. headScripts: [
  24. 'http://sp.qn.timichat.com/assets/AgoraRTCSDK/3.0.2/AgoraRTCSDK-3.0.2.js'
  25. ],
  26. hash: true,
  27. targets: {
  28. ie: 9,
  29. },
  30. routes: routerConfig,
  31. theme: {
  32. // ...darkTheme,
  33. 'primary-color': '#ff4d5c',
  34. },
  35. define: {
  36. ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
  37. ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
  38. },
  39. ignoreMomentLocale: true,
  40. lessLoader: {
  41. javascriptEnabled: true,
  42. },
  43. // cssLoader: {
  44. // modules: true,
  45. // getLocalIdent: (context, _, localName) => {
  46. // if (
  47. // context.resourcePath.includes('node_modules') ||
  48. // context.resourcePath.includes('ant.design.pro.less') ||
  49. // context.resourcePath.includes('global.less')
  50. // ) {
  51. // return localName;
  52. // }
  53. // const match = context.resourcePath.match(/src(.*)/);
  54. // if (match && match[1]) {
  55. // const antdProPath = match[1].replace('.less', '');
  56. // const arr = slash(antdProPath)
  57. // .split('/')
  58. // .map(a => a.replace(/([A-Z])/g, '-$1'))
  59. // .map(a => a.toLowerCase());
  60. // return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
  61. // }
  62. // return localName;
  63. // },
  64. // },
  65. extraPostCSSPlugins: [
  66. autoprefixer({
  67. flexbox: true
  68. })
  69. ],
  70. manifest: {
  71. basePath: '/',
  72. },
  73. proxy: {
  74. '/api-manage': {
  75. target: 'http://api.timichat.net',
  76. changeOrigin: true,
  77. //pathRewrite: { '^/server': '' },
  78. },
  79. '/api-common': {
  80. target: 'http://api.timichat.net',
  81. changeOrigin: true,
  82. //pathRewrite: { '^/server': '' },
  83. },
  84. '/rongcloud': {
  85. target: 'http://message.ronghub.com',
  86. changeOrigin: true,
  87. pathRewrite: { '^/rongcloud': '' },
  88. }
  89. },
  90. mock: {
  91. exclude: [],
  92. },
  93. publicPath: '/',
  94. // mfsu: {},
  95. webpack5: {},
  96. fastRefresh: {},
  97. dynamicImportSyntax: {},
  98. });