Vscode doesn't offer a way to prepulate locally running web extensions settings. If you just run them, you'll have to supply auth credentials and any configurations you want to set. That's painful for --watch as you edit the extension.
Use the run:web command from an extension that supports it. This command uses vscode:bundle:local which automatically enables local development mode. See Build for run:web and package.json details.
- Start the browser environment:
npm run run:web— opens VS Code web in Chrome with debugging enabled. - Test extension interaction: Explorer tab (file tree), Org Browser tab (extension switching), browser console (EventEmitter issues).
- Check for: auth flows, EventEmitter polyfill compatibility, CORS/network issues, extension dependency loading.
Extension bundling: Web extensions require Node.js polyfills (esbuild + browser polyfills, EventEmitter for jsforce, process/stream polyfills). See Build.
Port conflicts:
pkill -f "vscode-test-web|chrome.*9222" || trueAuthentication: Expected to fail in test environments due to CORS and isolated contexts. Use ESBUILD_WEB_ORG_ALIAS to inject org credentials at build time (below).
Org Browser: See packages/salesforcedx-vscode-org-browser/README.md for package-specific web tests and npm run test:web.
The web build supports injecting VS Code settings and org credentials at build time using environment variables and a configuration file.
Enables local development mode. When set, the build will read additional settings from .esbuild-web-extra-settings.json at the repo root.
This file is gitignored.
Note: run:web automatically uses vscode:bundle:local which sets ESBUILD_WEB_LOCAL=1 automatically. You don't need to set this manually when using run:web.
Specifies a Salesforce org alias to fetch credentials from. The build will run sf org display -o <alias> --json and inject the org's instanceUrl, accessToken, and apiVersion into VS Code settings.
export ESBUILD_WEB_ORG_ALIAS=myOrg
npm run run:web -w packages/salesforcedx-vscode-metadataCreate this file at the repo root (it's gitignored) to add additional VS Code settings that will be merged with org credentials (if provided).
Example:
{
"workbench.colorTheme": "Monokai",
"editor.fontSize": 14
}Settings from this file are merged with org credentials (if ESBUILD_WEB_ORG_ALIAS is set). The org credentials take precedence if there are conflicts.
export ESBUILD_WEB_ORG_ALIAS=myScratchOrg
npm run run:web -w packages/salesforcedx-vscode-metadataImportant: You must export the environment variable before running the command. Wireit envs are not transitive between commands, but they will all read from the same environment if you export it.
This will:
- Fetch org credentials from
myScratchOrgalias - Read additional settings from
.esbuild-web-extra-settings.json - Inject all settings into the bundle via esbuild
define - Apply settings at runtime when the extension activates
Settings not appearing?
- Clear wireit cache:
rm -rf packages/salesforcedx-vscode-services/.wireit packages/salesforcedx-vscode-services/dist - Verify
.esbuild-web-extra-settings.jsonexists at repo root - Check that org alias exists:
sf org list
Auth values missing?
- Verify
ESBUILD_WEB_ORG_ALIASis set correctly - Ensure the org alias exists and is authenticated:
sf org display -o <alias> - Clear wireit cache and rebuild (env vars don't invalidate cache automatically)