import { defineConfig } from 'umi';

export default defineConfig({
  define: {
    ENV: 'prod',
  },
  antd: false,
  // base: '/slave',
  // publicPath: '/slave/static/',
  base: '/spa/hrmSalary/hrmSalaryCalculateDetail/',
  publicPath: './',
  externals: {
    echarts: 'echarts',
    moment: 'moment',
    react: 'React',
    'react-dom': 'ReactDOM',
    mobx: 'mobx',
    antd: 'antd',
  },
  chunks: ['vendors', 'umi'],
  chainWebpack: function(config, { webpack }) {
    config.merge({
      optimization: {
        splitChunks: {
          chunks: 'all',
          minSize: 30000,
          minChunks: 3,
          automaticNameDelimiter: '.',
          cacheGroups: {
            vendor: {
              name: 'vendors',
              test({ resource }: any) {
                return /[\\/]node_modules[\\/]/.test(resource);
              },
              priority: 10,
            },
          },
        },
      },
    });
  },
});
