Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Deepen web route and vendor chunk splitting

tianmaf4ea1e5c6711
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index ea90c78b..e9986007 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -1,12 +1,15 @@
-import { useEffect } from "react";
+import { lazy, Suspense, useEffect } from "react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { Navigate, Route, Routes, useNavigate } from "react-router";
import { api } from "@/lib/api";
-import { EvernoteImportGuidePane } from "@/components/EvernoteImportGuidePane";
-import { LoginScreen } from "@/components/LoginScreen";
-import { WorkspaceApp } from "@/components/WorkspaceApp";
import type { AuthSession } from "@edgeever/shared";
+const EvernoteImportGuidePane = lazy(() =>
+ import("@/components/EvernoteImportGuidePane").then((module) => ({ default: module.EvernoteImportGuidePane }))
+);
+const LoginScreen = lazy(() => import("@/components/LoginScreen").then((module) => ({ default: module.LoginScreen })));
+const WorkspaceApp = lazy(() => import("@/components/WorkspaceApp").then((module) => ({ default: module.WorkspaceApp })));
+
const AuthLoadingScreen = () => (
<div className="flex h-[100dvh] items-center justify-center bg-slate-50 text-sm font-medium text-slate-600">
EdgeEver
@@ -17,16 +20,18 @@ const EvernoteMigrationRoute = () => {
const navigate = useNavigate();
return (
- <EvernoteImportGuidePane
- onClose={() => {
- if (window.opener) {
- window.close();
- return;
- }
-
- navigate("/");
- }}
- />
+ <Suspense fallback={<AuthLoadingScreen />}>
+ <EvernoteImportGuidePane
+ onClose={() => {
+ if (window.opener) {
+ window.close();
+ return;
+ }
+
+ navigate("/");
+ }}
+ />
+ </Suspense>
);
};
@@ -82,21 +87,25 @@ const AuthenticatedWorkspace = () => {
if (!session?.authenticated) {
return (
- <LoginScreen
- error={loginMutation.error instanceof Error ? loginMutation.error.message : null}
- isSubmitting={loginMutation.isPending}
- onSubmit={(payload) => loginMutation.mutate(payload)}
- />
+ <Suspense fallback={<AuthLoadingScreen />}>
+ <LoginScreen
+ error={loginMutation.error instanceof Error ? loginMutation.error.message : null}
+ isSubmitting={loginMutation.isPending}
+ onSubmit={(payload) => loginMutation.mutate(payload)}
+ />
+ </Suspense>
);
}
return (
- <WorkspaceApp
- authRequired={session.authRequired}
- isLoggingOut={logoutMutation.isPending}
- user={session.user}
- onLogout={() => logoutMutation.mutate()}
- />
+ <Suspense fallback={<AuthLoadingScreen />}>
+ <WorkspaceApp
+ authRequired={session.authRequired}
+ isLoggingOut={logoutMutation.isPending}
+ user={session.user}
+ onLogout={() => logoutMutation.mutate()}
+ />
+ </Suspense>
);
};
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index b6e8d681..42f6c773 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -83,10 +83,45 @@ export default defineConfig({
priority: 40,
},
{
- name: "vendor-editor",
- test: /node_modules[\\/](@tiptap|@floating-ui|prosemirror|orderedmap|rope-sequence|linkifyjs|tippy\.js)[\\/]/,
+ name: "vendor-prosemirror",
+ test: /node_modules[\\/](prosemirror-|orderedmap|rope-sequence)[\\/]/,
+ priority: 38,
+ },
+ {
+ name: "vendor-tiptap-pm",
+ test: /node_modules[\\/]@tiptap[\\/]pm[\\/]/,
+ priority: 36,
+ },
+ {
+ name: "vendor-tiptap-core",
+ test: /node_modules[\\/]@tiptap[\\/]core[\\/]/,
+ priority: 34,
+ },
+ {
+ name: "vendor-tiptap-react",
+ test: /node_modules[\\/]@tiptap[\\/]react[\\/]/,
+ priority: 32,
+ },
+ {
+ name: "vendor-tiptap-extensions",
+ test: /node_modules[\\/]@tiptap[\\/](extension-|extensions)[\\/]/,
priority: 30,
},
+ {
+ name: "vendor-tiptap-starter",
+ test: /node_modules[\\/]@tiptap[\\/]starter-kit[\\/]/,
+ priority: 29,
+ },
+ {
+ name: "vendor-linkify",
+ test: /node_modules[\\/]linkifyjs[\\/]/,
+ priority: 29,
+ },
+ {
+ name: "vendor-floating",
+ test: /node_modules[\\/](@floating-ui|tippy\.js)[\\/]/,
+ priority: 28,
+ },
{
name: "vendor-query",
test: /node_modules[\\/]@tanstack[\\/]react-query[\\/]/,
@@ -98,10 +133,25 @@ export default defineConfig({
priority: 20,
},
{
- name: "vendor-ui",
- test: /node_modules[\\/](@radix-ui|lucide-react|cmdk|vaul|class-variance-authority|clsx|tailwind-merge)[\\/]/,
+ name: "vendor-icons",
+ test: /node_modules[\\/]lucide-react[\\/]/,
+ priority: 18,
+ },
+ {
+ name: "vendor-radix",
+ test: /node_modules[\\/](@radix-ui|cmdk|vaul)[\\/]/,
priority: 15,
},
+ {
+ name: "vendor-ui-utils",
+ test: /node_modules[\\/](class-variance-authority|clsx|tailwind-merge)[\\/]/,
+ priority: 12,
+ },
+ {
+ name: "ui-primitives",
+ test: /src[\\/]components[\\/]ui[\\/]/,
+ priority: 10,
+ },
{
name: "vendor",
test: /node_modules[\\/]/,