import defaultSettings from './defaultSettings'; // https://umijs.org/config/ import { chainWebpack } from './plugin.config' import slash from 'slash2'; import themePluginConfig from './themePluginConfig'; // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 import { routerConfig } from './routerConfig.js'; import { defineConfig } from 'umi'; const autoprefixer = require('autoprefixer') const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env; const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site'; export default defineConfig({ antd: {}, dva: { hmr: true, }, locale: { // default zh-CN default: 'zh-CN', antd: true, // default true, when it is true, will use `navigator.language` overwrite default baseNavigator: true, }, headScripts: [ 'http://sp.qn.timichat.com/assets/AgoraRTCSDK/3.0.2/AgoraRTCSDK-3.0.2.js' ], hash: true, targets: { ie: 9, }, routes: routerConfig, theme: { // ...darkTheme, 'primary-color': '#ff4d5c', }, define: { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 }, ignoreMomentLocale: true, lessLoader: { javascriptEnabled: true, }, // cssLoader: { // modules: true, // getLocalIdent: (context, _, localName) => { // if ( // context.resourcePath.includes('node_modules') || // context.resourcePath.includes('ant.design.pro.less') || // context.resourcePath.includes('global.less') // ) { // 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()); // return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-'); // } // return localName; // }, // }, extraPostCSSPlugins: [ autoprefixer({ flexbox: true }) ], manifest: { basePath: '/', }, proxy: { '/api-manage': { target: 'http://api.timichat.net', changeOrigin: true, //pathRewrite: { '^/server': '' }, }, '/api-common': { target: 'http://api.timichat.net', changeOrigin: true, //pathRewrite: { '^/server': '' }, }, '/rongcloud': { target: 'http://message.ronghub.com', changeOrigin: true, pathRewrite: { '^/rongcloud': '' }, } }, mock: { exclude: [], }, publicPath: '/', // mfsu: {}, webpack5: {}, fastRefresh: {}, dynamicImportSyntax: {}, });