LWC js file content: import FIELDS from '@salesforce/schema/namespace__XYZ__c.namespace__Status__c';


"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+


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.

  • This feels a bit like an XY problem. Why do you need to strip off the namespace?
    – Phil W
    Commented Apr 8 at 11:11
  • The answer is simply deploying to different scratch orgs of different namespace. Commented Apr 8 at 13:21
  • And my question would still be "why"? Do you package the metadata in multiple different packages with different namespaces? Or is this so you can combine the package into an org used for developing different packages in different namespaces? If the latter, why not install the actual package (e.g. using a beta release version)? Either way, why not just replace all usages of "namespace__" with nothing (or some other namespace prefix)? Why try to be specific to these import statements?
    – Phil W
    Commented Apr 8 at 15:41


You must log in to answer this question.

Browse other questions tagged .