Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Dev Only Seems to Support Projects Created in \sfdx-source\main\default #219

Open
supert3d opened this issue Oct 25, 2024 · 2 comments

Comments

@supert3d
Copy link

Summary

Local Dev only appears to support LWC components created in the OOTB directory \sfdx-source\main\default our project uses a custom directory \sfdx-source\[customNamespace]\[directories]

Steps To Reproduce:

Expected Result

  • Browser loads
  • Able to live preview site

Actual Result

  • Browser loads
  • LWC changes made aren't reflected live.
  • Errors with Error (1): Expected workspace to have one lwc folder

Additional Information

If I DEBUG=* sf lightning dev app I get additional debug and can see Skipping [redacted]\sfdx-source\main\default because it does not exist or is not a directory which is correct I don't have this directory; we're using a custom directory.

Then it errors with
Error (1): Expected workspace to have one lwc folder

System Information

@salesforce/cli/2.63.8 win32-x64 node-v20.17.0

OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.22631 N/A Build 22631

GNU bash, version 5.2.12(1)-release (x86_64-pc-msys)

@ravijayaramappa
Copy link
Collaborator

@supert3d Thanks for filing the issue. Can you please attach the contents of sfdx-project.json to the issue description?

The reported issue appears to be similar to #185

@BradyNadeau
Copy link

BradyNadeau commented Oct 31, 2024

@supert3d , From my understanding ( Just as someone who peeked at the source this afternoon ), you may have to have a path ending in "lwc" if you choose not to confine by the OOTB path determined. Check out this line of code when creating the LWC Server:

const namespacePaths = (await Promise.all(packageDirs.map((dir) => glob(`${dir.fullPath}/**/lwc`)))).flat();

So your directory structure would have to look something like:

- myCustomPackage/
  - lwc/
    - myComponent/
      - myComponent.js
      - myComponent.html

Also worth noting that your sfdx-project.json would have to define your custom directory

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {
      "path": "myCustomPackage",
      "default": false
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "57.0"
}

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

No branches or pull requests

3 participants