Skip to content

Add support for @salesforce/messageChannel importsΒ #20

@lukethacoder

Description

@lukethacoder

Is your feature request related to a problem? Please describe.
Manually creating mocks and defining module name/path is a PITA.

"modules": [
  {
    "name": "@salesforce/messageChannel/CustomChannelOne",
    "path": "./__mocks__/@salesforce/messageChannel/CustomChannelOne.js"
  },
  {
    "name": "@salesforce/messageChannel/CustomChannelTwo",
    "path": "./__mocks__/@salesforce/messageChannel/CustomChannelTwo.js"
  }
]

Describe the solution you'd like
Instead of having to manually define messageChannel 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/messageChannel/CustomChannelTwo" and return a new LMS instance (see here)

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