config.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import { defineConfig } from 'umi';
  18. import defaultSettings from './defaultSettings';
  19. import proxy from './proxy';
  20. import routes from './routes';
  21. const { REACT_APP_ENV, SERVE_URL_DEV, SERVE_URL_TEST } = process.env;
  22. export default defineConfig({
  23. hash: true,
  24. antd: {},
  25. dva: {
  26. hmr: true,
  27. },
  28. locale: {
  29. default: 'en-US',
  30. antd: true,
  31. baseNavigator: true,
  32. },
  33. dynamicImport: {
  34. loading: '@/components/PageLoading/index',
  35. },
  36. targets: {
  37. ie: 11,
  38. },
  39. routes,
  40. layout: {
  41. name: 'APISIX Dashboard',
  42. locale: true,
  43. logo: '/favicon.png',
  44. },
  45. base: '/',
  46. publicPath: '/',
  47. define: {
  48. REACT_APP_ENV: REACT_APP_ENV || false,
  49. 'process.env': {
  50. SERVE_URL_DEV,
  51. SERVE_URL_TEST,
  52. },
  53. },
  54. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  55. theme: {
  56. 'primary-color': defaultSettings.primaryColor,
  57. },
  58. // @ts-ignore
  59. title: false,
  60. ignoreMomentLocale: true,
  61. proxy: proxy[REACT_APP_ENV || 'dev'],
  62. manifest: {
  63. basePath: '/',
  64. },
  65. outputPath: '../output/html',
  66. extraBabelPlugins: [
  67. [
  68. 'babel-plugin-istanbul',
  69. {
  70. exclude: ['**/.umi', '**/locales'],
  71. },
  72. ],
  73. ],
  74. });