Using angular ionic within Nrwl NX monorepo

I’m trying to create an Ionic Angular project within Nx Monorepo.

I’m able to initialize it and it opens successfully in browser, but running it on an emulator or real device results in net::ERR_CONNECTION_REFUSED error

I believe it’s related to some incorrect path somewhere…

Steps to reproduce

  1. create nx workspace with command:
    npx create-nx-workspace testProject
    (create empty project)
  2. than install @nrwl/angular
    npm install --save-dev @nrwl/angular
  3. nx g @nrwl/angular:app mobile --routing
  4. ng add @ionic/angular --project=mobile
  5. ionic init "mobile" --type=angular
  6. ionic integrations enable cordova –add
  7. Then run the app on emulator with ionic cordova emulate android --project=mobile

Here’s the repository with the code sample:

Hey! did you manage to solve that problem?
I am having the same issue

@luardo yes. With NX default build path is dist/apps/appName, while ionic expects it in www/ folder. You can achieve this by changing build path in angular.json.

We have only 1 mobile project within the monorepo, so it was fine to keep root www/ folder for ionic. Maybe it’s possible to configure the folder for the build artefacts, but I couldn’t find such information

So do you have any guide how to start ionic cordova app with nx?

As far as I know there’s a third party schematic made by someone from Ionic team Getting Started | Nxtend

But I’ve never tried it, to be honest