import { IConfig , IPlugin } from 'umi-types' ; import defaultSettings from './defaultSettings' ; import slash from 'slash2' ; import webpackPlugin from './plugin.config' ; const { pwa , primaryColor } = defaultSettings ; 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' ; const plugins = [ [ 'umi-plugin-react' , { antd : true , dva : { hmr : true , } , locale : { enable : true , default : 'zh-CN' , baseNavigator : true , } , pwa : pwa ? { workboxPluginMode : 'InjectManifest' , workboxOptions : { importWorkboxFrom : 'local' , } , } : false , } , ] , [ 'umi-plugin-pro-block' , { moveMock : false , moveService : false , modifyRequest : true , autoAddMenu : true , } , ] , ] ; if ( isAntDesignProPreview ) { plugins . push ( [ 'umi-plugin-ga' , { code : 'UA-72788897-6' , } , ] ) ; plugins . push ( [ 'umi-plugin-pro' , { serverUrl : 'https://ant-design-pro.netlify.com' , } , ] ) ; } export default { plugins , block : { defaultGitUrl : 'https://gitee.com/ant-design/pro-blocks' , } , hash : true , targets : { ie : 11 , } , devtool : isAntDesignProPreview ? 'source-map' : false , routes : [ { path : '/user' , component : '../layouts/UserLayout' , routes : [ { name : 'login' , path : '/user/login' , component : './user/login' , } , ] , } , { path : '/' , component : '../layouts/SecurityLayout' , routes : [ { path : '/' , component : '../layouts/BasicLayout' , authority : [ 'admin' , 'user' ] , routes : [ { path : '/' , redirect : '/analysis' , } , { name : 'dashboard.analysis' , path : '/analysis' , component : './analysis' , icon : 'dashboard' , } , { path : '/runtime' , name : 'runtime' , icon : 'history' , routes : [ { name : 'jobExecutionHistory' , path : '/runtime/jobExecutionHistory' , component : './runtime/jobExecutionHistory' , icon : 'bar-chart' , } , { component : './404' , } , ] , } , { path : '/platform' , name : 'platform' , icon : 'cloud-server' , routes : [ { name : 'quartzTriggerList' , path : '/platform/quartzTriggerList' , component : './platform/quartzTriggerList' , icon : 'schedule' , } , { name : 'jobRunDetail' , path : '/platform/jobRunDetail' , component : './platform/jobRunDetail' , icon : 'play-circle' , } , { name : 'quartzJob' , path : '/platform/quartzJob' , component : './platform/quartzJob' , icon : 'play-circle' , } , { component : './404' , } , ] , } , { path : '/configuration' , name : 'configuration' , icon : 'control' , routes : [ { name : 'triggerList' , path : '/configuration/triggerList' , component : './configuration/triggerList' , icon : 'schedule' , } , { name : 'jobList' , path : '/configuration/jobList' , component : './configuration/jobList' , icon : 'play-circle' , } , { component : './404' , } , ] , } , { component : './404' , } , ] , } , { component : './404' , } , ] , } , { component : './404' , } , ] , theme : { 'primary-color' : primaryColor , } , define : { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION : ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '' , } , ignoreMomentLocale : true , lessLoaderOptions : { javascriptEnabled : true , } , disableRedirectHoist : true , cssLoaderOptions : { 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 ; } , } , manifest : { basePath : '/' , } , chainWebpack : webpackPlugin , proxy : [ { context : [ '/batch' , '/trigger' , '/job' , '/quartz' , '/oauth' , '/userApi' ] , target : 'http://localhost:8080' , } ] } as IConfig ;