@nxtend/capacitor plugin will be added to your workspace and a Capacitor project will be automatically generated with a new
@nxtend/ionic-react application. However, you can add Capacitor to an existing project.
First, you need to initialize the
First, ensure that the frontend project has been built:
Once the plugin has been added to your Nx workspace you can generate a Capacitor project from an existing frontend project:
Nx will ask you some questions about the application, but you can customize it further by passing these options:
Now that a Capacitor project has been added to your Nx workspace you can begin adding support for native platforms. Currently, Capacitor supports Android and iOS, but other platforms can be added with Capacitor plugins.
Running the sync command will update the native platform dependencies and copy a build of your frontend project to the Capacitor project:
Finally, you can open the native platform in it's respective IDE:
Capacitor plugin dependencies must be added to both the root and project-level
To learn more about Capacitor, including the native API's available, please read the official Capacitor documentation.