Splitting App into different apps with common core and modules

We have an existing app built with ionic 3.20.0 that was tailored for a very specific purpose. Now there is a demand for an app with many similarities. We want to reuse the existing code by splitting into a common core and different modules that can be enabled or disabled by the different apps and configured (if enabled).
There is also a possibility for more such applications in the future. Or some modules might be enabled for one app, that previously were only needed for the other app. So just copying the project and changing it, is not an option.

We had several ideas how to attempt this, but all approaches come with some kind of drawback or complication:

Using git branches

We are using git for version control, so it would be possible to have one branch for the core app and the modules. And a branch for each app that deletes the unused modules and makes some changes to bind the modules together into a working app.
We think that this is not a nice solution, and want to avoid this if possible.

Putting everything together and configuring via config files.

This would be like building one big app that has the features of both apps, but when building, some of the features would be disabled by config files. Modules and the core would have their own folder within each part of the app. e.g. src/pages/core, src/pages/module-x, src/pages/module-y.
This sounds like an acceptable solution, but we are not sure if this is even possible with ionic.

Building our own framework on top of the ionic Framework

Another option would be to build our own Framework on top of the Ionic Framework. This would include our current design, our own components and parts of the back end. This way we would probably get more code duplication, but have smaller code fragments. The result would be our first application, our second application and the new Framework itself separated from each other.
This solution would also be acceptable, but we are unsure about if and how it can be achieved.

These are just some ideas we had, but we are not sure how well they would work. Is there a proper and professional way to build these kinds of applications with ionic? Google wasn’t very helpful yet.

We hope anyone has a good idea and would appreciate any help.