mirror of
https://github.com/zuiidea/antd-admin.git
synced 2026-10-19 16:14:37 +00:00
- Add second sample resource (orders): API, schemas, MSW, routes, menu, Lingui, and E2E. - Introduce useCrudToasts, useUrlSearchState, useTableFitHeight; extend useResourceCRUD with optimistic updates; add Vitest coverage for hooks and createHandler. - Implement token refresh in http layer, RouteError, and new E2E specs (auth-refresh, rbac, url-state). - Replace gen-resource codegen with English add-resource.instructions.md; fix Copilot instruction YAML in with-lingui and basic. - Add with-lingui CI workflow, Cursor thin rules, optimization plan doc, and refresh README/AGENTS. - Bump packages/create and lockfile where applicable. Made-with: Cursor
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
import { defineConfig } from "vite-plus";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
import { lingui } from "@lingui/vite-plugin";
|
|
|
|
const VENDOR_CHUNKS: Array<{ chunk: string; test: (id: string) => boolean }> = [
|
|
{
|
|
chunk: "vendor-antd",
|
|
test: (id) =>
|
|
id.includes("node_modules/antd") || id.includes("node_modules/rc-"),
|
|
},
|
|
{
|
|
chunk: "vendor-tanstack",
|
|
test: (id) => id.includes("node_modules/@tanstack/"),
|
|
},
|
|
{
|
|
chunk: "vendor-ui",
|
|
test: (id) => id.includes("node_modules/lucide-react"),
|
|
},
|
|
{
|
|
chunk: "vendor-i18n",
|
|
test: (id) =>
|
|
id.includes("node_modules/@lingui/") || id.includes("/@lingui/"),
|
|
},
|
|
];
|
|
|
|
function manualChunkForId(id: string): string | undefined {
|
|
for (const { chunk, test } of VENDOR_CHUNKS) {
|
|
if (test(id)) return chunk;
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tanstackRouter({
|
|
routesDirectory: "./src/routes",
|
|
generatedRouteTree: "./src/routeTree.gen.ts",
|
|
}),
|
|
react({
|
|
plugins: [["@lingui/swc-plugin", {}]],
|
|
}),
|
|
lingui(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": "/src",
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: (id: string) => manualChunkForId(id),
|
|
},
|
|
},
|
|
chunkSizeWarningLimit: 1024,
|
|
},
|
|
staged: {
|
|
"*": "vp check --fix",
|
|
},
|
|
lint: { options: { typeAware: true, typeCheck: true } },
|
|
});
|