Sharing JavaScript between multiple Lightning Components

Currently the recommended mechanism for this is to use a Static Resource and include it in any components that need to share the same JavaScript via ltng:require (loads the library once and only once similar to requirejs).


I'm bringing up this old post in case anyone searches for this. I've created a Service Component pattern. It's working great for one of my production projects, but it still has plenty of room for improvement.

The Service Component pattern has more re-usability and is more akin to having one place to reference an Apex Controller.

https://github.com/tsalb/sfdc-lightning-service-components