To share an ES6 module:
- Create a service component (library) using the Lightning Web Components programming model.
- To use the code in an Aura component, use the same syntax that you use to import an Aura component and call its methods. For example code, see the Aura
lightning:navigationItemAPIcomponent docs. Note that
lightning:navigationItemAPIis an Aura component, not an ES6 module, but to import an ES6 module, you use the same Aura syntax.
The lwc-recipes repo has an
lmsPublisherWebComponent module that enables communication between Lightning web components and Aura components. The
pubsub module has been retired but can be used in containers such as Experience Cloud, which doesn’t support Lightning Message Service.