config.ts 1.9 KB

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