Creating a capacitor library as opposed to an app?

I’d like a bit of guidance on how to structure this thing i’m trying to make. I’m trying to make a library that can be used by other apps via ionic web portals, however I also need to be able to use capacitor plugins from inside the web code of this library.

The documentation around capacitor suggests its only intended for taking a web app and compiling it to native apps, but in this case I just want my library to be usable by other web apps/native apps, so there is no web app in my product. I just want capacitor in the sense that I want to use plugins for things like bluetooth connections in my library, I dont need/want to compile down to runnable native applications.

1 Like

Portals is what we were already looking at for the native solutions (basically make a very simple web app which essentially just consumes our library), but we were still trying to figure out how to make something similar for web based consumers of this component library. The answer seems to actually be pretty simple though: we didn’t realize that if the consuming app had registered a capacitor plugin, any module inside of it can also leverage that plugin, which solves my initial question.

So for the web consumer case (assuming the web consumer is itself a capacitor app, which it would be in our case) we just need to document that they need to register the appropriate plugins that our library needs. With that, we can guarantee (assuming our consumers have met requirements) that whether the native app be actually a native app consuming our web portal, or a native app that is compiled from a web app via capacitor which itself consumes our library, we will have the plugin implementation in place and we can use it from within our library components.