salesforcedx – How to use regex pattern with replaceWithEnv in replacements property in sfdx-project.json before deploying or creating package?
LWC js file content:
import FIELDS from ‘@salesforce/schema/namespace__XYZ__c.namespace__Status__c’;
sfdx-project.json:
"replacements": [
{
"glob": "file_path",
"regexToReplace": "@salesforce/schema/namespace__\\w+\\.namespace__\\w+",
"replaceWithEnv": "REGEX_TO_REPLACE_NAMESPACE"
}
]
Environment variable:
REPLACE_SCHEMA_SECOND_NAMESPACE=@salesforce/schema/\w+\.\w+
Expected:
import FIELDS from '@salesforce/schema/XYZ__c.Status__c';
I want to use the replace regexToReplace with a regex pattern. I can’t find any documentation regarding this.
Read more here: Source link
