You need to sign in to do that
Don't have an account?
Packaging With Dependent Package Custom Labels
I'm currently having some trouble deploying my code to my org. The current package I'm working on has a dependent package "BASE_PACKAGE". I was trying to use Custom Labels, the problem is if there's any overlap in the custom labels it causes issues when trying to install.
However, if I try to use the base packages custom labels, if I try to use the namespace when importing in the LWC like,
import MANUFACTURER from '@salesforce/label/BASE_PACKAGE.MANUFACTURER';
I get this error message
Error integration LWC1504: Invalid module id "BASE_PACKAGE.MANUFACTURER" for type "label". Explicit use of namespace "BASE_PACKAGE" in file "customLabels.js" is prohibited.
When I try to replace it with
import MANUFACTURER from '@salesforce/label/c.MANUFACTURER';I'm able to deploy to my scratch org, but when I try to deploy the packaged code, I get this error message instead
Invalid reference c.MANUFACTURER of type label in file customLabels.js
I'm not sure if I'm missing a setting, or if there's something I'm missing.
To handle custom labels from a dependent package, Please try adding custom label something like below:
Thanks.
To resolve the issue with dependent packages and custom labels:
Namespace your custom labels in the base package (e.g., BASE_PACKAGE.MANUFACTURER).
Use the entire package namespace to reference these custom labels in your code (e.g., '@salesforce (https://developer.salesforce.com/)/label/BASE_PACKAGE.MANUFACTURER').
Ensure that your dependent package lists the base package as a dependency.
Maintain consistent namespace prefixes for custom labels and stickers. (https://custompackaginglosangeles.com/stickers-labels/)
Deploy the base package first, followed by the dependent package, and configure scratch orgs accordingly.
Following these steps should help you avoid conflicts and deploy your code successfully.