config.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import defaultSettings from './defaultSettings';
  4. import proxy from './proxy';
  5. import { adMonitor, launchSystem, launchSystemV3 } from './routerConfig';
  6. // const CompressionWebpackPlugin = require('compression-webpack-plugin');
  7. const { REACT_APP_ENV } = process.env;
  8. export default defineConfig({
  9. headScripts: [
  10. { src: 'https://unpkg.com/mediainfo.js', type: "text/javascript" }
  11. ],
  12. metas: [
  13. { httpEquiv: 'Content-Security-Policy', content: "script-src 'self' *.alibaba-inc.com *.dingtalk.com *.alicdn.com *.alipay.com" }
  14. ],
  15. history: {
  16. type: 'hash',
  17. },
  18. // 默认是 browse
  19. hash: true,
  20. antd: {
  21. // dark: true
  22. // compact: true, // 开启紧凑主题
  23. },
  24. dva: {
  25. hmr: true,
  26. },
  27. layout: {
  28. name: '趣程投放工具',
  29. locale: false,
  30. siderWidth: 208
  31. },
  32. locale: {
  33. // default zh-CN
  34. default: 'zh-CN',
  35. // default true, when it is true, will use `navigator.language` overwrite default
  36. antd: true,
  37. baseNavigator: true,
  38. },
  39. dynamicImport: {
  40. //按需加载组件
  41. loading: '@/components/PageLoading/index',
  42. },
  43. targets: {
  44. ie: 11,
  45. },
  46. // umi routes: https://umijs.org/docs/routing
  47. routes: [
  48. {
  49. path: '/user',
  50. layout: false,
  51. routes: [
  52. {
  53. name: 'login',
  54. path: '/user/login',
  55. component: './user/login',
  56. },
  57. ],
  58. },
  59. // operatePage, //运营配置
  60. // dataStatistics, //数据中心配置
  61. launchSystem, // 投放系统
  62. launchSystemV3,
  63. adMonitor, // 广告监控
  64. // enterpriseWeChat,//企业微信
  65. {
  66. path: '/',
  67. redirect: '/',
  68. },
  69. {
  70. component: './404',
  71. },
  72. ],
  73. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  74. theme: {
  75. // ...darkTheme,
  76. 'primary-color': defaultSettings.primaryColor,
  77. },
  78. // @ts-ignore
  79. title: false,
  80. ignoreMomentLocale: true,
  81. proxy: proxy[(REACT_APP_ENV || 'dev') as keyof typeof proxy],
  82. manifest: {
  83. basePath: '/',
  84. },
  85. });