config.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. antd: true,
  19. baseNavigator: true,
  20. },
  21. headScripts: [
  22. 'http://sp.qn.timichat.cn/assets/AgoraRTCSDK/3.0.2/AgoraRTCSDK-3.0.2.js'
  23. ],
  24. hash: true,
  25. targets: {
  26. ie: 9,
  27. },
  28. routes: routerConfig,
  29. theme: {
  30. 'primary-color': '#ff4d5c',
  31. },
  32. define: {
  33. ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
  34. 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 专用环境变量,请不要在你的项目中使用它。
  35. },
  36. ignoreMomentLocale: true,
  37. lessLoader: {
  38. javascriptEnabled: true,
  39. },
  40. extraPostCSSPlugins: [
  41. autoprefixer({
  42. flexbox: true
  43. })
  44. ],
  45. manifest: {
  46. basePath: '/',
  47. },
  48. proxy: {
  49. '/api-manage': {
  50. target: 'http://api.dev.hidouyou.com',
  51. changeOrigin: true,
  52. },
  53. '/api-common': {
  54. target: 'http://api.dev.hidouyou.com',
  55. changeOrigin: true,
  56. },
  57. '/rongcloud': {
  58. target: 'http://message2.ronghub.com',
  59. changeOrigin: true,
  60. pathRewrite: { '^/rongcloud': '' },
  61. }
  62. },
  63. mock: {
  64. exclude: [],
  65. },
  66. publicPath: '/',
  67. outputPath: '/manage',
  68. // mfsu: {}, //开启后热更新失效,当前版本慎用
  69. webpack5: {},
  70. fastRefresh: {},
  71. dynamicImportSyntax: {},
  72. esbuild: {}, //替换压缩器为 esbuild
  73. // devtool: false,
  74. nodeModulesTransform: {
  75. type: 'none',
  76. exclude: [],
  77. }
  78. });