forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Routing to component folder when project has multiple directory structure #12

Open ndrewr opened 4 years ago

ndrewr commented 4 years ago

I am not sure if this use case is just not supported, but I have a project split into multiple folders under force-app/ like this:

src/
  force-app/
    main/
      ...legacy non-lwc stuff
    community-app/
      default/lwc

where all LWC are under a different directory from main/.

My first thought was to set localdevserver.config.json like such:

{
"namespace": "c",
"main": "communityApp",
"modulesSourceDirectory": "./force-app/community-app/",
"staticResourcesDirectory": "staticresources",
}

but this still results in an error:

Error: ENOENT: no such file or directory, scandir '/home/uncleoptimus/Code/Salesforce/AHH-CCA-Portal/force-app/cca-portal/main/default/lwc'

Is there a way for me to configure and successfully direct the local server to the components under force-app/community-app/default?

mysticflute commented 4 years ago

Unfortunately this will not work for now with that particular folder structure, but support for multiple projects is on our list.

In the meantime something that should work is if you change your structure a bit, so that community-app is a sibling to force-app, with a main/default/lwc folder inside: community-app/main/default/lwc. Then you could add this additional project to your sfdx-project.json file as the default (see https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm), or you could use the localdevserver.config.json to point modulesSourceDirectory to the community-app directory.

lcampos commented 4 years ago

Wanted to provide an update on this. Release 2.4.0 provides support for project structures that do not follow the force-app/main/default/lwc convention. We are working on supporting multiple directories and for now we are previewing the directory set as the default one in the project's sfdx-project.json (packageDirectories) or the one configured through localdevserver.config.json (modulesSourceDirectory)