Background
react/src/components/LoginView.tsx loads an optional login plugin from <repo>/src/plugins/<name> via dynamic import(). That directory is .gitignored and frequently absent in dev trees (fresh clones, make clean, branches without local plugins).
Why the dev server breaks
Vite's optimizeDeps scanner (esbuild-based) treats template literals with a static prefix — `../../../src/plugins/${name}` — as a glob pattern and walks the filesystem at dev-server start. When src/plugins/ is missing or empty, this scan fails and the dev server cannot boot.
Why FR-2873 (PR #7377) did not fully resolve it
The previous fix moved the path into an intermediate variable and added @vite-ignore. However, the static prefix literal still appears in the AST, so esbuild's optimizeDeps scanner continues to glob-scan it. @vite-ignore is not honored by the scanner pass.
Fix
Replace the dynamic import() with Vite's native import.meta.glob primitive at module scope:
const loginPlugins = import.meta.glob('../../../src/plugins/*.js');
// inside useEffect:
const loader = loginPlugins[\`../../../src/plugins/\${name}.js\`];
if (!loader) { /* graceful fallback */ }
loader().catch(...);
- Vite rewrites this call at build/dev-start time into a static map of
() => import(...) loaders.
- Missing or empty
src/plugins/ simply yields {} — no esbuild scan, no dev server failure.
- Preserves ESM
export semantics, source maps, and HMR.
Also: docs update
AGENTS.md (which CLAUDE.md symlinks to) referenced stale tooling (Craco/Webpack/Jest, workbox-webpack-plugin, craco.config.cjs). Updated to reflect the current stack: Vite 6 + @vitejs/plugin-react + vite-plugin-pwa + vite-plugin-svgr + vite-plugin-node-polyfills, and Vitest 4 for unit tests.
Relates
—
Captured while working on branch: main
JIRA Issue: FR-2903
Background
react/src/components/LoginView.tsxloads an optional login plugin from<repo>/src/plugins/<name>via dynamicimport(). That directory is.gitignoredand frequently absent in dev trees (fresh clones,make clean, branches without local plugins).Why the dev server breaks
Vite's
optimizeDepsscanner (esbuild-based) treats template literals with a static prefix —`../../../src/plugins/${name}`— as a glob pattern and walks the filesystem at dev-server start. Whensrc/plugins/is missing or empty, this scan fails and the dev server cannot boot.Why FR-2873 (PR #7377) did not fully resolve it
The previous fix moved the path into an intermediate variable and added
@vite-ignore. However, the static prefix literal still appears in the AST, so esbuild's optimizeDeps scanner continues to glob-scan it.@vite-ignoreis not honored by the scanner pass.Fix
Replace the dynamic
import()with Vite's nativeimport.meta.globprimitive at module scope:() => import(...)loaders.src/plugins/simply yields{} — no esbuild scan, no dev server failure.exportsemantics, source maps, and HMR.Also: docs update
AGENTS.md(whichCLAUDE.mdsymlinks to) referenced stale tooling (Craco/Webpack/Jest, workbox-webpack-plugin, craco.config.cjs). Updated to reflect the current stack: Vite 6 +@vitejs/plugin-react+vite-plugin-pwa+vite-plugin-svgr+vite-plugin-node-polyfills, and Vitest 4 for unit tests.Relates
—
Captured while working on branch: main
JIRA Issue: FR-2903