import { defineConfig } from "umi";

export default defineConfig({
  base: "/",
  publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
  outputPath: "flowchartDesigner",
  esbuildMinifyIIFE: true,
  favicons: ["/favicon.ico"],
  styles: ["//at.alicdn.com/t/c/font_4913485_f1n1mdl1yr6.css"],
  metas: [
    {
      name: "viewport",
      content:
        "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no",
    },
  ],
  proxy: {
    "/api": {
      // 'target': 'http://ab.dev.jbpm.shalu.com/',
      // 'target': 'https://edesign.shalu.com/',
      // target: "https://zh-roadassets-m-dev.shalu.com/",
      target: "http://localhost:8080/dev-api/",
      changeOrigin: true,
      pathRewrite: { "^/api": "" },
    },
  },
  scripts: ["//at.alicdn.com/t/c/font_4767192_5rinbe5e4f6.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: "",
  },
  model: {},
  unocss: {
    watch: ["src/**/*.tsx"],
  },
  icons: {
    autoInstall: {},
  },
  history: { type: "hash" },
  routes: [
    { path: "/:id", component: "designer" },
    { path: "/*", component: "404" },
  ],
  npmClient: "pnpm",
});
