修复打包后文件展示问题

This commit is contained in:
2025-08-13 14:42:22 +08:00
parent 2e18805c47
commit 997423d7e9
118 changed files with 54576 additions and 31 deletions

View File

@@ -5,32 +5,54 @@ import { ErrorBoundary } from "./components/ErrorBoundary";
import { AnalyticsErrorBoundary } from "./components/AnalyticsErrorBoundary";
import { analytics, resourceMonitor } from "./lib/analytics";
import { PostHogProvider } from "posthog-js/react";
import { loader } from "@monaco-editor/react";
import "./lib/i18n"; // 初始化国际化
import "./assets/shimmer.css";
import "./styles.css";
// Initialize analytics before rendering
// Configure Monaco loader to use local assets (copied to /public/monaco/vs)
try {
loader.config({ paths: { vs: "/monaco/vs" } });
} catch (e) {
console.error("[Monaco] loader.config failed:", e);
}
// Initialize analytics before rendering (will no-op if no consent or no key)
analytics.initialize();
// Start resource monitoring (check every 2 minutes)
resourceMonitor.startMonitoring(120000);
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<PostHogProvider
apiKey={import.meta.env.VITE_PUBLIC_POSTHOG_KEY}
options={{
api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
defaults: '2025-05-24',
capture_exceptions: true,
debug: import.meta.env.MODE === "development",
}}
>
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
const posthogKey = (import.meta as any).env.VITE_PUBLIC_POSTHOG_KEY as string | undefined;
if (posthogKey) {
root.render(
<React.StrictMode>
<PostHogProvider
apiKey={posthogKey}
options={{
api_host: (import.meta as any).env.VITE_PUBLIC_POSTHOG_HOST,
capture_exceptions: true,
debug: import.meta.env.MODE === "development",
}}
>
<ErrorBoundary>
<AnalyticsErrorBoundary>
<App />
</AnalyticsErrorBoundary>
</ErrorBoundary>
</PostHogProvider>
</React.StrictMode>
);
} else {
root.render(
<React.StrictMode>
<ErrorBoundary>
<AnalyticsErrorBoundary>
<App />
</AnalyticsErrorBoundary>
</ErrorBoundary>
</PostHogProvider>
</React.StrictMode>,
);
</React.StrictMode>
);
}