Skip to content

Add support for @salesforce/schema importsΒ #19

@lukethacoder

Description

@lukethacoder

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions