import defaultSettings from './config/defaultSettings'
import proxy from './config/proxy'
import routes from './config/routes'
import { defineConfig } from '@umijs/max'

const { REACT_APP_ENV } = process.env

export default defineConfig({
    title: defaultSettings.title,
    theme: {
        'primary-color': defaultSettings.primaryColor
    },
    model: {},
    antd: {
    },
    request: {},
    initialState: {
        loading: '@/components/Loading'
    },
    dva: {},
    //  layout: {},
    // mfsu: { strategy: 'normal' },
    locale: {
        default: 'zh-CN',
        antd: true,
        baseNavigator: false
    },
    fastRefresh: true,
    history: {
        type: 'browser'
    },
    hash: false,
    // publicPath: "./", //本地静态化 for android
    publicPath: "/", //部署到服务端需要 publicPath: "/",或者 publicPath: "/xxxxx/",
    manifest: {
        basePath: "/", //本地静态化 for android 部署到服务端需要 publicPath: "/",或者 publicPath: "/xxxxx/",
    },
    routes: routes,
    proxy: proxy[REACT_APP_ENV || 'dev'],
    codeSplitting: {
        jsStrategy: 'granularChunks'
    },
    chainWebpack(config, { webpack }) {
        config.plugin('code-inspector-plugin').use(require('code-inspector-plugin').codeInspectorPlugin, [
            {
                bundler: 'webpack',
            },
        ]);
    },
})
