lwc-garden icon indicating copy to clipboard operation
lwc-garden copied to clipboard

Add support for @salesforce/schema imports

Open lukethacoder opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. Manually defining schema imports for each field is a PITA.

"modules": [
  {
    "name": "@salesforce/schema/Account.Id",
    "path": "./__mocks__/@salesforce/schema/Account.Id.js"
  },
  {
    "name": "@salesforce/schema/Account.Name",
    "path": "./__mocks__/@salesforce/schema/Account.Name.js"
  }
]

Describe the solution you'd like Instead of having to manually define schema imports, auto-calculate them as part of a custom module resolver or hook, adding to the existing @lwc-garden/utils package.

Take the import "@salesforce/schema/Account.Id" and return the text after the final / (e.g. "Account.Id"). May be worth considering namespaced packages?

Describe alternatives you've considered Could build a script that dynamically updates the lwr.config.json modules array.

lukethacoder avatar Mar 01 '25 06:03 lukethacoder