import os from 'os'; import pageRoutes from './router.config'; const isDev = process.env.NODE_ENV === "development"; const publicPath = isDev ? '/' : './'; export default { targets: { // 配置浏览器最低版本 ie: 9, }, // exportStatic: {}, // 导出全部路由为静态页面 plugins: [ [ 'umi-plugin-react', { antd: true, dva: { hmr: true }, targets: { ie: 11, }, locale: { enable: true, // default false default: 'zh-CN', // default zh-CN baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default }, // dynamicImport: true, ...(!process.env.TEST && os.platform() === 'darwin' ? { dll: { include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], exclude: ['@babel/runtime'], }, hardSource: false, pwa: false } : {}), }, ], [ 'umi-plugin-ga', { code: 'UA-72788897-6', judge: () => process.env.APP_TYPE === 'site', }, ], ], externals: { '@antv/data-set': 'DataSet', }, ignoreMomentLocale: true, lessLoaderOptions: { javascriptEnabled: true, }, disableRedirectHoist: true, cssLoaderOptions: { modules: true, getLocalIdent: (context, localIdentName, 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 = antdProPath .split('/') .map(a => a.replace(/([A-Z])/g, '-$1')) .map(a => a.toLowerCase()); return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-'); } return localName; }, }, theme: { 'primary-color': '#E14C46', 'icon-normal-color': '#333', 'icon-disable-color': '#CCC', "card-actions-background": "#f5f8fa", "user-login-header-background": "rgb(248, 228, 228)" }, // 路由配置 history: 'hash', routes: pageRoutes, publicPath: publicPath, hash: !isDev, devtool: isDev? "cheap-module-eval-source-map":"cheap-module-source-map", proxy: { "/wbalone/open/getEncryptParam": { target: "http://zt.maydos.com.cn/wbalone/open/getEncryptParam", changeOrigin: true, pathRewrite: { "^/wbalone/open/getEncryptParam" : "" } }, "/wbalone/account/login": { target: "http://zt.maydos.com.cn/wbalone/account/login", changeOrigin: true, pathRewrite: { "^/wbalone/account/login" : "" } }, "/occ-cmpt": { target: "http://zt.maydos.com.cn/occ-cmpt", changeOrigin: true, pathRewrite: { "^/occ-cmpt" : "" } }, "/g1": { target: "http://zt.maydos.com.cn/g1", changeOrigin: true, pathRewrite: { "^/g1" : "" } }, "/occ-": { target: "http://zt.maydos.com.cn", changeOrigin: true, pathRewrite: { "^/" : "/" } }, }, manifest: { name: 'CHANNEL CLOUD', background_color: '#FFF', description: 'An out-of-box UI solution for enterprise applications as a React boilerplate.', display: 'standalone', start_url: '/index.html', icons: [ { src: '/favicon.png', sizes: '48x48', type: 'image/png', }, ], }, };