/* eslint-disable react/destructuring-assignment */ // https://umijs.org/config/ const pageRoutes = require('./router.config'); const path = require('path'); export default { // add for transfer to umi plugins: [ [ 'umi-plugin-react', { dva: true, antd: true, locale: { default: 'zh-CN', // default zh-CN baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default }, }, ], // TODO 决定是否使用约定路由,如果使用配置路由那么 umi-plugin-routes 可以去掉了 // [ // 'umi-plugin-routes', // { // exclude: [/\.test\.js/], // update(routes) { // return [...pageRoutes, ...routes]; // }, // }, // ], ], // 路由配置 routes: pageRoutes, theme: { 'card-actions-background': '#f5f8fa', }, env: { development: { extraBabelPlugins: ['dva-hmr'], }, }, 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 antdProPath = context.resourcePath.match(/src(.*)/)[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, '-'); }, }, 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', }, ], }, };