salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

SFDX Local Dev Server commands not found in multi-root workspace

Open microweii opened this issue 2 years ago • 1 comments

Summary

When loading a multi-root workspace, the SFDX commands relating to the local dev server do not work, saying the command is not found (See image). Note: If a single-root workspace is loaded, the command works, and the command continues to work after adding new root folders to the workspace. It will fail as above once the new workspace is reloaded.

Steps To Reproduce:

  1. On Windows, have SFDX CLI installed via .exe (not npm).
  2. Install dev server using command: sfdx plugins:install @salesforce/lwc-dev-server.
  3. Open VS Code.
  4. Create a multi-root workspace (e.g. 2 different SFDX project folders) and save the workspace file.
  5. Set a default scratch org.
  6. Reload the workspace.
  7. In command palette, execute SFDX: Start local development server

Expected result

There should be no error prompt, and a successful command output should appear like below:

Starting SFDX: Start Local Development Server

11:56:01.901 sfdx force:lightning:lwc:start
Use of this plugin is subject to the Salesforce.com Program Agreement. 
By installing this plugin, you agree to the Salesforce.com Program Agreement<https://trailblazer.me/terms> 
and acknowledge the Salesforce Privacy Policy<https://www.salesforce.com/company/privacy.jsp>.


Starting LWC Local Development.
	Username: ...
	Api Version: 49.0

[HPM] Proxy created: /  -> https://...
[HPM] Subscribed to http-proxy events: [ 'proxyReq', 'error', 'close' ]
LWR6003: Listening on :PORT
Server up on http://localhost:PORT

Actual result

When executing the command, the error Command 'SFDX: Start Local Development Server' resulted in an error (command 'sfdx.force.lightning.lwc.start' not found) appears, and then nothing executes. image

Additional information

Use case for workspaces I use workspace files to hold some settings specific for SFDX, such as disabling unnecessary extensions and having different SFDX settings for different kinds of SFDX projects (e.g. trailhead vs commercial work). I'd like to work with multi-root workspaces as a way to quickly navigate between projects, which is useful if I need to quickly refer to another project/repository's code, without having to load a new VS Code window (and therefore re-execute extensions). The SFDX Extension Pack in particular takes a relatively long time for me to load (at least 1 minute, often longer).

Other plugins active I have some other plugins installed; doubtful they have any impact on this issue but for completeness, I'm listing them as well:

  • SFDMU
  • sfpowerkit
  • sfdx-git-delta

Salesforce Extension Version in VS Code: v55.0.0

SFDX CLI Version: sfdx-cli/7.153.1 win32-x64 node-v16.15.0

OS and version:

Parameter Value
Edition Windows 10 Enterprise (64-bit, x64-based processor)
Version 21H2
OS build 19044.1706
Experience Windows Feature Experience Pack 120.2212.4170.0
Installed RAM 16.0 GB

microweii avatar Jun 10 '22 02:06 microweii

Hi @microweii thanks for opening this! As of right now, the Salesforce Extensions don't support multi-root workspaces. More info here: https://github.com/forcedotcom/salesforcedx-vscode/issues/970. We'll be looking into this further in a future iteration, feel free to provide more information around the type of experience you'd be looking for.

AnanyaJha avatar Jun 14 '22 19:06 AnanyaJha