// ref: https://umijs.org/config/ import proxyMap from "./src/conf/proxyMap"; // const proxyMap = require('./proxyMap') export default { treeShaking: true, // chainWebpack(config) { // // config.plugin('moment-locales').use(momentLocalesWebpackPlugin, [{ // // localesToKeep: ['zh-cn'], // // }]) // config.merge({ // optimization: { // minimize: true, // splitChunks: { // chunks: 'all', // minSize: 30000, // minChunks: 3, // automaticNameDelimiter: '.', // cacheGroups: { // vendors: { // name: 'common', // test({ resource }) { // return /[\\/]node_modules[\\/]/.test(resource); // }, // priority: 10, // }, // }, // }, // } // }) // }, plugins: [ // ref: https://umijs.org/plugin/umi-plugin-react.html [ "umi-plugin-react", { antd: true, dva: true, dynamicImport: { webpackChunkName: true }, title: "后端应用后台", dll: true, routes: { exclude: [ /models\//, /services\//, /model\.(t|j)sx?$/, /service\.(t|j)sx?$/, /components\//, ], }, }, ], ], proxy: (function () { const proxyArr = Object.keys(proxyMap).map((apiPrefix) => ({ [apiPrefix]: { target: proxyMap[apiPrefix], changeOrigin: true, pathRewrite: { [`^${apiPrefix}`]: "" }, cookieDomainRewrite: "", }, })); const proxy = proxyArr.reduce((acc, item) => ({ ...acc, ...item }), {}); return proxy; })(), };