👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
2.4 KiB

/* eslint-disable react/destructuring-assignment */
// https://umijs.org/config/
const pageRoutes = require('./router.config');
const webpackplugin = require('./plugin.config');
const path = require('path');
export default {
// add for transfer to umi
plugins: [
[
'umi-plugin-react',
{
antd: true,
dva: {
hmr: true,
},
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
},
polyfills: ['ie9'],
...(
require('os').platform() === 'darwin'
? {
dll: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
hardSource: true,
}
: {}
),
},
],
],
// 路由配置
routes: pageRoutes,
theme: {
'card-actions-background': '#f5f8fa',
},
externals: {
'@antv/data-set': 'DataSet',
rollbar: 'rollbar',
},
alias: {
components: path.resolve(__dirname, '../src/components/'),
utils: path.resolve(__dirname, '../src/utils/'),
assets: path.resolve(__dirname, '../src/assets/'),
common: path.resolve(__dirname, '../src/common/'),
},
ignoreMomentLocale: true,
lessLoaderOptions: {
javascriptEnabled: true,
},
cssLoaderOptions: {
modules: true,
getLocalIdent: (context, localIdentName, localName) => {
if (
context.resourcePath.includes('node_modules') ||
context.resourcePath.includes('ant.design.pro.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, '-');
} else {
return localName;
}
},
},
manifest: {
name: 'ant-design-pro',
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',
},
],
},
chainWebpack: webpackplugin,
};