fix(FR-2903): align login plugin loader with page plugin runtime fetch pattern#7433
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage Report for react-coverage (./react)
File Coverage
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
Replaces the dynamic import() in LoginView.tsx with Vite's import.meta.glob to prevent esbuild's optimizeDeps scanner from glob-scanning the src/plugins/ directory, which is .gitignored and often absent in dev trees. Also updates AGENTS.md to reflect the current Vite/Vitest stack instead of stale Craco/Webpack/Jest references.
Changes:
- Use
import.meta.glob('../../../src/plugins/*.js')to build a static loader map at compile time, falling back gracefully when the plugin file is missing. - Update
AGENTS.mdto document the current Vite 6 + vite-plugin-pwa + Vitest 4 stack.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| react/src/components/LoginView.tsx | Switches login plugin loading from dynamic import() to import.meta.glob, with explicit .js key lookup and missing-loader fallback. |
| AGENTS.md | Updates build/test/tooling references from Craco/Webpack/Jest to Vite/Vitest. |
7b39d86 to
976098e
Compare
976098e to
9869e4e
Compare
9869e4e to
cbd6ff2
Compare

Resolves #7432(FR-2903)
Summary
Realign the login-screen
plugin.loginslot with the existing page plugin loading model (PluginLoader.tsx): runtime URL fetch from/dist/plugins/<name>.js(or${apiEndpoint}/dist/plugins/<name>.jsin Electron). Replaces the originalimport('../../../src/plugins/${name}')flow that crashed Vite's dev server when<repo>/src/plugins/was missing — because esbuild'soptimizeDepsscanner treated the static prefix as a glob and tried to walk an absent directory.Why runtime fetch instead of
import.meta.glob?import.meta.globenumerates at build time — fine when the build machine has plugins, but breaks the deployment model where customer-specific plugins are deployed to the running WebServer's static dir after the WebUI bundle ships. Runtime URL fetch matches the page-plugin convention and decouples plugin distribution from the WebUI release cadence.Changes
react/src/components/LoginView.tsx— replace the relative-prefixed dynamic import withimport(/* @vite-ignore */ pluginUrl)wherepluginUrlmirrorsPluginLoader.tsx's URL resolution.error.LoginPluginLoadFailed("Failed to load login plugin." / "로그인 플러그인을 가져오지 못했습니다.") to 21 locales. Used by the plugin-load.catchso users see a deployment-issue-specific message instead of the genericLoginFailed.e2e/plugin/login-plugin.spec.ts+e2e/plugin/backend-ai-homepage-link.js— first regression test for the slot. Mirrors the existing page-plugin test pattern (modifyConfigToml+page.routeinterception). The fixture (a side-effect IIFE appending a "Visit backend.ai" link to the login form) doubles as a living plugin-contract reference for future authors.config.toml.sample— annotate#loginwith an inline comment:Inject a JavaScript file into the login page.so the slot's purpose is discoverable without reading source.plugin.sidebar— remove the#sidebar = "report-cloud.js"fossil line fromconfigs/{default,main,debug}.toml. The slot was briefly wired up in 2020 (PR Plugin architecture for menus #315) but the handler was merged into thepagesystem within the same PR (commit20c3e15b9); no code has read this key in any era since. Keeping the line in samples misled future readers into thinking it was a live extension surface.AGENTS.md(=CLAUDE.mdsymlink) — update stale Craco/Webpack/Jest references to Vite 6 +vite-plugin-pwa+ Vitest 4 so the agent guidance reflects the current stack.Test plan
bash scripts/verify.shpassese2e/plugin/login-plugin.spec.tspasses (2/2, ~3s) — positive injection + negative-when-slot-unset casespnpm devboots cleanly when<repo>/src/plugins/is empty or missing[plugin] login = "...", deploy plugin file to WebServer's/dist/plugins/, confirm link injectione2e/plugin/plugin-system.spec.ts)Notes
import.meta.globfrom the initial direction. Scope grew during review to the architectural realignment above.<repo>/src/plugins/directory is now unused by any code path. Follow-up cleanup PR could remove the directory + the.gitignoreentries that reserved it.react/src/diagnostics/rules/configRules.tsvalidator still has aplugin.sidebarentry that validates the (now-removed) sample line's filename format. Candidate for the same follow-up cleanup PR.