import { defineConfig } from "umi";

export default defineConfig({
  base: '/',
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  outputPath: 'systemDesign',
  esbuildMinifyIIFE: true,
  favicons: [
    '/favicon.ico'
  ],
  styles: [
    '//at.alicdn.com/t/c/font_4676747_4n0ccqebfqj.css'
  ],
  metas: [
    { name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' }
  ],
  scripts: [
    // 字体加载
    // '//ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js'
    '//at.alicdn.com/t/c/font_4676747_ild1695qz8.js'
  ],
  plugins: [
    require.resolve('@umijs/plugins/dist/unocss'),
    require.resolve('@umijs/plugins/dist/model'),
    require.resolve('@umijs/plugins/dist/initial-state'),
    require.resolve('@umijs/plugins/dist/request'),
  ],
  request: {
    dataField: '',
  },
  proxy: {
    '/api': {
      // 'target': 'http://ab.dev.jbpm.shalu.com/',
      'target': 'https://edesign.shalu.com/',
      'changeOrigin': true,
      'pathRewrite': { '^/api' : '' },
    },
  },
  model: {},
  unocss: {
    watch: ['src/**/*.tsx']
  },
  icons: {
    autoInstall: {}
  },
  history: { type: 'hash' },
  routes: [
    { path: "/", component: "home" },
    { path: "/flow/:id", component: "flow" },
    { path: "/mindmap/:id", component: "mindmap" },
    { path: "/*", component: '404' }
  ],
  npmClient: 'pnpm'
});
