0

I am having different set of LWC components some under force-app and some under common folder. My sxdf-project.json is

{
    "packageDirectories": [{
            "path": "force-app",
            "default": true,
            "package": "Finance",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT"
        },
        {
            "path": "common",
            "default": false
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "49.0",
    "packageAliases": {
        "Finance": "0Ho2w0000004CpQCAU",
       
    }
}

when I tried to create 2GP unlocked package version with the below command

sfdx force:package:version:create --package "Finance" --installationkeybypass --wait 20 --path "force-app,common"

I am getting below error

The --path (-d) value [force-app,common], doesn’t match the path value in any packageDirectories specified in sfdx-project.json

Am I missing someting or Can't we include two folders during version creation ?

3

No, you're not missing anything. Each package may only be one directory. From your question, it appears you want two packages, with the force-app package depending on the common package.

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "Finance",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "dependencies": [{ "package": "Common@0.1.0.1" }]
        },
        {
            "path": "common",
            "default": false,
            "package": "Common",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT"
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "49.0",
    "packageAliases": {
        "Finance": "0Ho2w0000004CpQCAU",
        "Common": "<to-be-created>"
    }
}

Future packages can then also depend on the common package as well.

2
  • whether its allowed to create unlocked package for "common" and reference it to "force-app" which I am trying as Managed package? Apr 11 at 13:14
  • @SFDC-Beginner No, you'd need two managed packages.
    – sfdcfox
    Apr 11 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.