forcedotcom / lwc-dev-server-feedback

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

Support multiple source module directories #44

Open mikebernard opened 4 years ago

mikebernard commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like In the localdevserver.config.json, it would be helpful if the modulesSourceDirectory could take an array of paths to source LWCs from so I don't have to flatten my directory structure in order to use all of my project's LWCs in the local dev server.

"modulesSourceDirectory": [ "src/nFORCE/ui-navigation/lwc/", "src/nFORCE/common/lwc/" ]

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

KrisGraySFDC commented 4 years ago

Thank Mike, this is something we've discussed. We'll update you on what we decide longer term for multiple source directories.

Side question, do you have multiple projects that you're working in here?

tkauffman1 commented 4 years ago

@KrisGraySFDC This is something we would like too. We have multiple LWC's in different directories. A common directory for instance will hold custom lwc's built to be used as children in components in our 'Sales/ui/lwc' Directory.

vazexqi commented 4 years ago

@KrisGraySFDC @ntotten - This is also impacting me. I am using 2GP packaging with multiple packageDirectories in my sfdx-project.json. The LWC Local Server only picks up the one that is marked with default:true.

Is there no way to have it serve multiple packages? One would assume from the UI and the label of "Packages" (plural) that this is supported.

1_APjpBOXMWxYNg3-aL-aM3w

Am I missing something?

KrisGraySFDC commented 4 years ago

Thats on the backlog, we decided to keep the plurality in the UI since it will eventually show up and listing just one as "package" didn't make much since.

mikebernard commented 4 years ago

Thank Mike, this is something we've discussed. We'll update you on what we decide longer term for multiple source directories.

Side question, do you have multiple projects that you're working in here?

@KrisGraySFDC sorry for the delayed response. We do have multiple projects/applications within the same repository.

aslambari commented 4 years ago

I dont know if this is related or not but I am facing same issue with LWC open source implementation. There we have lwc-services.config.js file. In that file also we are allowed to give only 1 sourceDir. This way, LWC OSS only supporting Single Page Application. But my client want to have multi page website using this framework. I am not sure how to do that?

Esya commented 4 years ago

Hi, I'm adding our usecase here :

We are using existing packages that we've added as git submodules that offer really nice components such as lwc-utils, and we're embedding those components in our LWC components.

Our sfdx-project.json looks like this :

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {
      "path": "utils/lwc-utils/force-app"
    }
  ],
...

Our components run fine on SF but we're unable to test and develop them locally since we rely on components in that other directory.

Is there any update on this matter, or any temporary workaround for this ? Thanks

msimonis commented 3 years ago

I have a similar use case to others mentioned here, and without support, the plugin cannot be used.

Basically we have our main directory that gets packaged, but we also have an unpackaged directory for developing recipes, showing how the LWC's can be used.

{ "packageDirectories": [ { "path": "sfdx-source/component-library", "default": true }, { "path": "sfdx-source/unpackaged/lwc-recipes" } ], ...

Ideally with the local dev server, you could specify the directories to power the component list (maybe through an argument) instead of pulling all LWC's in the project. And also supporting multiple directories so it can compile with the dependencies in another directory.

nathanlb commented 3 years ago

My team has the same use case as @msimonis so this would be very very much appreciated. 👍