diff --git a/docs/AGENTS.md b/docs/AGENTS.md index 1eb92520f..262cbb4a8 100644 --- a/docs/AGENTS.md +++ b/docs/AGENTS.md @@ -18,6 +18,7 @@ gh pr view --json mergeable,mergeStateStatus | jq '.' ./scripts/wait_pr_checks.sh ``` +- Generally run `wait_pr_checks` after submitting a PR to ensure CI passes. - Status decoding: `mergeable=MERGEABLE` clean; `CONFLICTING` needs resolution. `mergeStateStatus=CLEAN` ready, `BLOCKED` waiting for CI, `BEHIND` rebase, `DIRTY` conflicts. - If behind: `git fetch origin && git rebase origin/main && git push --force-with-lease`. - Never enable auto-merge or merge at all unless the user explicitly says "merge it". diff --git a/src/desktop/main.ts b/src/desktop/main.ts index 1880421ba..4eb8f39d9 100644 --- a/src/desktop/main.ts +++ b/src/desktop/main.ts @@ -25,33 +25,7 @@ import assert from "@/common/utils/assert"; import { loadTokenizerModules } from "@/node/utils/main/tokenizer"; // React DevTools for development profiling -// Using require() instead of import since it's dev-only and conditionally loaded -interface Extension { - name: string; - id: string; -} - -type ExtensionInstaller = ( - ext: { id: string }, - options?: { loadExtensionOptions?: { allowFileAccess?: boolean } } -) => Promise; - -let installExtension: ExtensionInstaller | null = null; -let REACT_DEVELOPER_TOOLS: { id: string } | null = null; - -if (!app.isPackaged) { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const devtools = require("electron-devtools-installer") as { - default: ExtensionInstaller; - REACT_DEVELOPER_TOOLS: { id: string }; - }; - installExtension = devtools.default; - REACT_DEVELOPER_TOOLS = devtools.REACT_DEVELOPER_TOOLS; - } catch (error) { - console.log("React DevTools not available:", error); - } -} +// Using dynamic import() to avoid loading electron-devtools-installer at module init time // IMPORTANT: Lazy-load heavy dependencies to maintain fast startup time // @@ -509,8 +483,12 @@ if (gotTheLock) { migrateLegacyMuxHome(); // Install React DevTools in development - if (!app.isPackaged && installExtension && REACT_DEVELOPER_TOOLS) { + if (!app.isPackaged) { try { + // eslint-disable-next-line no-restricted-syntax + const { default: installExtension, REACT_DEVELOPER_TOOLS } = await import( + "electron-devtools-installer" + ); const extension = await installExtension(REACT_DEVELOPER_TOOLS, { loadExtensionOptions: { allowFileAccess: true }, });