fix(FR-2873): avoid esbuild glob analysis of plugin import path in LoginView#7377
Merged
yomybaby merged 1 commit intoMay 12, 2026
Conversation
Member
Author
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. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts LoginView’s login-plugin dynamic import to avoid Vite/esbuild dependency scanner (optimizeDeps) statically analyzing the import specifier as a glob during development.
Changes:
- Refactors the dynamic
import()call to use a runtime-computedpluginUrlvariable instead of an inline template literal. - Adds inline documentation explaining why
@vite-ignorealone is insufficient and why the specifier must not be statically analyzable.
Comment on lines
+195
to
+197
| // is treated by esbuild as a glob and fails to resolve in dev because | ||
| // `webui-ai/src/plugins/` only exists in production builds. `@vite-ignore` | ||
| // alone is not enough — esbuild's scanner does not honor that comment. |
| /* @vite-ignore */ | ||
| `../../../src/plugins/${sanitizedPlugin}` | ||
| ).catch(() => { | ||
| // Build the plugin path at runtime, in a variable, so neither Vite nor |
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves #7376(FR-2873)
Summary
pnpm devstarted failing onmainafter #7332 (FR-2856) with:Root cause
LoginView.tsx's dynamicimport()was a template literal with a static prefix (`../../../src/plugins/${sanitizedPlugin}`). esbuild'soptimizeDepsscanner treats this as a glob (../../../src/plugins/**/*) and fails becausewebui-ai/src/plugins/only exists in production builds.@vite-ignoresuppresses Vite's static-analysis warning, but esbuild's scanner does not honor it — so the latent issue surfaced as soon as #7332 invalidated the install / Vite cache and the scanner re-ran.The companion file
PluginLoader.tsxalready uses the correct pattern (assign to a variable first, thenimport(/* @vite-ignore */ pluginUrl)); onlyLoginView.tsxhad the inline template literal.Fix
Match
PluginLoader.tsx: assign the path to a variable first so neither Vite nor esbuild can statically analyze the specifier.Runtime behavior is unchanged — sanitization still happens before path interpolation, and the production loader (
<base>/dist/plugins/<name>.js) is unaffected (different code path inPluginLoader.tsx).Test plan
pnpm devboots without theCould not resolve import("../../../src/plugins/**/*")esbuild errorloginPluginconfiguredloginPlugin = "<some-plugin>"inconfig.toml, the dynamic import still resolves at runtime (path-traversal sanitization unchanged)🤖 Generated with Claude Code