基于umi的开发模板

.umirc.ts 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import * as path from 'path';
  2. import { IConfig } from 'umi-types';
  3. // ref: https://umijs.org/config/
  4. const config: IConfig = {
  5. history: 'hash',
  6. treeShaking: true,
  7. disableGlobalVariables: true,
  8. "define": {
  9. "process.env.API_ENV": process.env.API_ENV
  10. },
  11. devtool: 'cheap-module-eval-source-map',
  12. plugins: [
  13. // ref: https://umijs.org/plugin/umi-plugin-react.html
  14. ['umi-plugin-react', {
  15. antd: true,
  16. dva: {
  17. immer: true
  18. },
  19. dynamicImport: false,
  20. title: 'game_name',
  21. dll: false,
  22. locale: {
  23. default: 'zh-CN', //默认语言 zh-CN
  24. baseNavigator: true, // 为true时,用navigator.language的值作为默认语言
  25. antd: true, // 是否启用antd的<LocaleProvider />
  26. },
  27. routes: {
  28. exclude: [
  29. /models\//,
  30. /services\//,
  31. /model\.(t|j)sx?$/,
  32. /service\.(t|j)sx?$/,
  33. /components\//,
  34. ],
  35. },
  36. }],
  37. ],
  38. routes: [
  39. {
  40. path: '/',
  41. component: '../layouts/index',
  42. routes: [
  43. { path: '/', component: './main' },
  44. { path: '/main', component: './main' },
  45. { path: '/game', component: './game' },
  46. { path: '/rank', component: './rank' },
  47. ],
  48. },
  49. ],
  50. }
  51. export default config;