David Kimura PRO said almost 4 years ago on Referencing Stimulus controllers in a gem :
I think that publishing them as an NPM project would be more appropriate for Rails apps with webpacker. https://www.driftingruby.com/episodes/creating-and-publishing-a-stimulus-controller-library. You could also do it with a gem similar to how Hotwire does it with its helpers and module types.