config.js 2.16 KB
Newer Older
邓晓峰's avatar
邓晓峰 committed
1

2 3 4 5 6
const proxy = require('./proxy');
const slash = require('slash2');
const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env;
module.exports = {
邓晓峰's avatar
邓晓峰 committed
7 8
  // mfsu: {},
  webpack5: {},
邓晓峰's avatar
邓晓峰 committed
9
  base: '/civbase',
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
  title: '熊猫智慧城市监控管理解决方案',
  hash: true,
  layout: {
    siderWidth: '145px',
    locale: true,
    ...defaultSetting
  },
  fastRefresh: true,
  locale: {
    default: 'zh-CN',
    antd: true,
    baseNavigator: true,
  },
  dynamicImport: {
    loading: '@ant-design/pro-layout/es/PageLoading',
  },
  // theme: {
  //   '@primary-color': '#ff9600',
  // },
  ignoreMomentLocale: true,
  nodeModulesTransform: {
邓晓峰's avatar
邓晓峰 committed
31 32
    type: 'none',
    exclude: ['@wisdom-map/arcgismap', '@wisdom-map/arcgismap/lib/arcgisapi', 'swagger-ui-react'],
33 34
  },
  proxy: proxy[REACT_APP_ENV || 'dev'],
35 36 37 38 39
  // openAPI: {
  //   requestLibPath: "import { request } from '@wisdom-utils/utils'",
  //   schemaPath: 'http://192.168.10.150:8777/Publish/OMS/swagger/v1/swagger.json',
  //   mock: false,
  // },
40 41 42 43 44 45 46 47
  postcssLoader: {},
  styleLoader: {},
  cssLoader: {
    modules: {
      getLocalIdent: (context, _, localName) => {
        if (
          context.resourcePath.includes('node_modules') ||
          context.resourcePath.includes('ant.design.pro.less') ||
邓晓峰's avatar
邓晓峰 committed
48 49
          context.resourcePath.includes('global.less') ||
          context.resourcePath.includes('ThemeColor.less')
50 51 52 53 54 55 56 57 58 59 60 61
        ) {
          return localName;
        }

        const match = context.resourcePath.match(/src(.*)/);

        if (match && match[1]) {
          const antdProPath = match[1].replace('.less', '');
          const arr = slash(antdProPath)
            .split('/')
            .map(a => a.replace(/([A-Z])/g, '-$1'))
            .map(a => a.toLowerCase());
62 63 64 65
          return `panda-console-base${arr.join('-')}-${localName}`.replace(
            /--/g,
            '-',
          );
66 67 68 69 70
        }
        return localName;
      },
    },
  },
邓晓峰's avatar
邓晓峰 committed
71 72 73
  lessLoader: {
    modifyVars: {
      // hack: `true; @import "~@/global.less";`,
74 75
      '@ant-prefix': 'panda-console-base',
      '@iconPrefixCls': 'panda-console-base-icon'
邓晓峰's avatar
邓晓峰 committed
76 77 78
    },
    javascriptEnabled: true
  },
邓晓峰's avatar
邓晓峰 committed
79
  workerLoader: {}
邓晓峰's avatar
邓晓峰 committed
80
  // esbuild: {}
81
};