Skip to content

@W-21111861@ feat: Skip standalone proxy when Vite WebApp proxy is active#23

Merged
deepu-mungamuri94 merged 5 commits into
refactor-webapp-discoveryfrom
feat/vite-proxy-detection
Feb 18, 2026
Merged

@W-21111861@ feat: Skip standalone proxy when Vite WebApp proxy is active#23
deepu-mungamuri94 merged 5 commits into
refactor-webapp-discoveryfrom
feat/vite-proxy-detection

Conversation

@deepu-mungamuri94
Copy link
Copy Markdown
Collaborator

Adds automatic detection of Vite's built-in WebApp proxy via health check endpoint (?sfProxyHealthCheck=true). When the Vite plugin responds with X-Salesforce-WebApp-Proxy: true header, the standalone proxy server is skipped and the dev server URL is used directly.
Also adds TTY-aware messaging to show appropriate stop instructions based on execution context.

What does this PR do?

  • Add checkViteProxyActive() to detect Vite's WebAppProxyHandler
  • Skip standalone proxy when Vite proxy is active
  • Add TTY detection for appropriate stop message:
    • Terminal: "Press Ctrl+C to stop"
    • IDE/CI: "Server running (stop via the calling process)"
  • Add info.vite-proxy-detected and info.server-running messages

What issues does this PR fix or reference?

@W-21111861@

@deepu-mungamuri94 deepu-mungamuri94 requested a review from a team as a code owner February 10, 2026 10:59
Copy link
Copy Markdown

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my edits/questions.

Comment thread messages/webapp.dev.md Outdated
Comment thread messages/webapp.dev.md Outdated
Comment thread messages/webapp.dev.md Outdated
Comment thread messages/webapp.dev.md Outdated
Copy link
Copy Markdown
Contributor

@bpbuch bpbuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should the webapp dev command be invoked when using the Vite plugin? Wouldn't the developer invoke the vite dev server directly?

@deepu-mungamuri94
Copy link
Copy Markdown
Collaborator Author

Why should the webapp dev command be invoked when using the Vite plugin? Wouldn't the developer invoke the vite dev server directly?

For the one-click preview functionality in VSCode.

- Detect Vite WebApp proxy via health check, skip standalone proxy when active
- Use getErrorPageTemplate from @salesforce/webapp-experimental/proxy
- TTY-aware stop message (Ctrl+C in terminal vs VS Code command palette)
- Add info.ready-for-development-vite for Vite proxy case
- Simplify ready-for-development to show only URL to open
- Resolve PR review comments on messaging

Co-authored-by: Cursor <cursoragent@cursor.com>
@deepu-mungamuri94 deepu-mungamuri94 force-pushed the feat/vite-proxy-detection branch from 676b4f2 to ce709c7 Compare February 13, 2026 15:31
deepu-mungamuri94 and others added 4 commits February 13, 2026 21:10
…x type

- Run yarn install to resolve 1.23.0+ (was 0.2.0 from stale lock)
- ProxyServer: use minimal fallback { name, outputDir } per PR #22
- Tests: remove label/version from manifest fixtures
- ManifestWatcher tests: fix assertions for simplified type

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Collaborator

@amritmishra-sf amritmishra-sf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deepu-mungamuri94 deepu-mungamuri94 merged commit ea13492 into refactor-webapp-discovery Feb 18, 2026
14 checks passed
@deepu-mungamuri94 deepu-mungamuri94 deleted the feat/vite-proxy-detection branch February 18, 2026 06:18
deepu-mungamuri94 added a commit that referenced this pull request Feb 20, 2026
…93297@ (#18)

* refactor(dev): improve webapp discovery and console output @W-21193297@

- Add SFDX project detection for webapp discovery
- Simplify webapplications folder detection logic
- Condense warning messages, remove verbose JSON examples
- Add help tip for configuration options

* feat: W-21111977 consume error-page template from @salesforce/webapp-experimental/proxy (#22)

* feat: consume error-page template from @salesforce/webapp-experimental/proxy @W-21111977@

Update plugin-webapp to import the error page HTML template from the
@salesforce/webapp-experimental proxy package instead of bundling it locally.

Migration changes:
- ErrorPageRenderer now uses getErrorPageTemplate() from @salesforce/webapp-experimental/proxy
- Removed local error-page.html template (now lives in webapps package)
- Removed scripts/copy-templates.cjs (no longer needed)
- Removed postbuild script from package.json
- Bumped @salesforce/webapp-experimental dependency to ^1.17.0

Bug fixes included:
- DevServerManager: emit DevServerError directly instead of wrapping in SfError,
  so the proxy can display the "Dev Server Error" page when dev server crashes
- ProxyServer: add socket error handler to prevent ECONNRESET from crashing the
  proxy when dev server dies mid-connection

Depends on: salesforce-experience-platform-emu/webapps PR for @W-21111977@

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: W-21111977 consume error-page template from @salesforce/webapp-experimental/proxy

Update plugin-webapp to import the error page HTML template from the
@salesforce/webapp-experimental proxy package (v1.23.0) instead of
bundling it locally.

Migration changes:
- ErrorPageRenderer now uses getErrorPageTemplate() from
  @salesforce/webapp-experimental/proxy (direct import, no workarounds)
- Removed local error-page.html template (now lives in webapps package)
- Removed scripts/copy-templates.cjs (no longer needed)
- Removed postbuild script from package.json
- Bumped @salesforce/webapp-experimental dependency to ^1.23.0

Bug fixes included:
- DevServerManager: emit DevServerError directly instead of wrapping
  in SfError, so the proxy can display the "Dev Server Error" page
  when dev server crashes
- ProxyServer: add socket error handler to prevent ECONNRESET from
  crashing the proxy when dev server dies mid-connection
- ProxyServer: remove label/version from fallback manifest (not in type)

Depends on: salesforce-experience-platform-emu/webapps#86 (merged)

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Ankit Singh <singhankit@singhank-ltmg4lv.internal.salesforce.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: address PR feedback and merge conflicts

- messages: specify 'proxy server' in Ctrl+C stop message
- ProxyServer: add label and version to fallback WebAppManifest
- ErrorPageRenderer: use local template (getErrorPageTemplate not in package)
- tests: add label and version to WebAppManifest fixtures

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert: drop merge-fix changes, keep only PR feedback

Keep only the messages change: 'Press Ctrl+C to stop the proxy server'.
Revert ErrorPageRenderer, ProxyServer, and test changes - will address separately.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: address PR review comments

- no-manifest: log applied defaults (dev command, proxy port) at info level
- ready-for-development: show only URL to open in browser (proxy URL)
- flags.url: add dev server URL precedence to help text

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: remove unused error-page-template.ts

Co-authored-by: Cursor <cursoragent@cursor.com>

* @W-21111861@ feat: Skip standalone proxy when Vite WebApp proxy is active (#23)

* feat: add Vite proxy detection and TTY-aware messaging

- Detect Vite WebApp proxy via health check, skip standalone proxy when active
- Use getErrorPageTemplate from @salesforce/webapp-experimental/proxy
- TTY-aware stop message (Ctrl+C in terminal vs VS Code command palette)
- Add info.ready-for-development-vite for Vite proxy case
- Simplify ready-for-development to show only URL to open
- Resolve PR review comments on messaging

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: remove label/version to match @salesforce/webapp-experimental 1.x type

- Run yarn install to resolve 1.23.0+ (was 0.2.0 from stale lock)
- ProxyServer: use minimal fallback { name, outputDir } per PR #22
- Tests: remove label/version from manifest fixtures
- ManifestWatcher tests: fix assertions for simplified type

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: group ready-for-development messages, simplify Vite message format

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: update server-running message - remove bold, add quotes

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>

* Address review comments: URL mismatch tests, multi-meta warning, 60s timeout

- Add comprehensive tests for devServerUrl vs actualDevServerUrl mismatch
  combinations (explicit URL match/mismatch, manifest, skipDevServer cases)
- Warn when multiple .webapplication-meta.xml files found in directory;
  use first match for backward compatibility
- Increase dev server startup timeout from 30 to 60 seconds to align with
  VS Code extension and support slower dev server startups

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor: discover webapps from all package directories via SfProject

Co-authored-by: Cursor <cursoragent@cursor.com>

* Update SF_WEBAPP_DEV_GUIDE.md

Co-authored-by: Brian Buchanan <5377888+bpbuch@users.noreply.github.com>

* Update SF_WEBAPP_DEV_GUIDE.md

Co-authored-by: Brian Buchanan <5377888+bpbuch@users.noreply.github.com>

* Update SF_WEBAPP_DEV_GUIDE.md

Co-authored-by: Brian Buchanan <5377888+bpbuch@users.noreply.github.com>

* SF_WEBAPP_DEV_GUIDE: document only dev.command and dev.url for dev command

- Remove name, label from --name option (matches folder name)
- Simplify picker format, remove label references
- Remove Full Configuration example (name, label, version, outputDir)
- Add Dev + Routing example with only dev and routing
- Update troubleshooting: --name matches folder name only

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert README to main branch

Co-authored-by: Cursor <cursoragent@cursor.com>

* Align README with main branch (plugin-app-dev template)

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Ankit Singh <singhankit@salesforce.com>
Co-authored-by: Ankit Singh <singhankit@singhank-ltmg4lv.internal.salesforce.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Brian Buchanan <5377888+bpbuch@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants