hey guys :smile: have you worked with ionic and nx and if so… whats the best approach to add nx to a current ionic project?
I’ve never used ionic before, is it similar to an angular workspace?
similar, but all the guides I’ve found are to have a nx ws setup from scratch
Nx can convert an angular workspace to an nx workspace. You can also create the files needed for the nx workspace yourself. There isn’t too much to be honest. create an empty nx workspace (that uses the angular cli) then look at the tsconfig, nx.json, and jest.config.js
Those are the main files, there will be some scripts you want in the package.json as well. Each nx package is scoped to @nrwl so the packages you’ll need will be @nrwl/workspace @nrwl/angular @nrwl/jest (if using jest) etc
Does ionic use the angular cli for building?
it does for the pwa part but then if you wanna build the hybrid apps you use cordova
Ok that’s fine, you don’t need to use nx for everything. You can write your own build scripts.
Try and convert the workspace to an nx workspace using the nx CLI.
so the best approach would be to convert my current ionic ws to a nx ws using nx cli?
sorry, i’m kinda new to the whole nx experience
No problem! Ya I would suggest that.
There are docs for it
I think you just
ng add @nrwl/workspace@latest
for some reason I tried that yesterday and everytime I tried it said “unable to read options of undefined”, gave up lol
perhaps it has something to do with ionic
btw thanks, you’re amazing
No I remember we had that happen to us
I think it was a comment in a JSON file but can’t remember. do you remember how we solved that?
I think im gonna go from 0 and start from scratch my app using NX, a question tho, does NX supports Ionic out of the box?
No it doesn’t it supports Angular, which I believe ionic jsut wraps?
Ya unfortunately it is hard for the Nrwl team to maintain and manage all of the different types of frameworks, but it should be relatively easy to manage an ionic app with some custom build scripts.
Agreed, plus it might be the final nail in the coffin that I needed to drop cordova (seeing an article atm which gives a guide on how to add ionic with capacitor to NX)
Perfect! There is also NativeScript if you have never looked at that before.
Jeez, now that I think about all of this… I started this endeavor no longer than 3 months ago and all the things I’ve learned to far its like boooooom! Such a wonderful journey filled with lots of teachings :slightly_smiling_face:
Ya there is SO much to learn. I had never built a website before 2 years ago so I am right there with you.
I’ve built websites before using angular but im in the process of making my own app (and hopefully, one day live off it :smile:) and yeah… every step I take its filled with lots of more questions than answers.. sometimes thats a pain but others is just mind blowing
Good luck with making the app, its an interesting market to penetrate, and if you like Angular nativescript might be for you
thanks! you’re great and also, never expected so much help out of the blue ^^
That is why we setup this community, so that people can get help where they need it like we wish we had had when we started using Nx
Hey guys sorry for the delay been super sick. We got that error because of a formatting error in one of our tsconfig. I believe we had comments in json and nx hates that, check your files for comments and lint them and you should be good to go
Hey Alex, sorry to hear that and I hope you are feeling better ^_^ Thanks for the advice but as I told Jay, I think ill just go from scratch, considering that the app is a bit small at the moment, I think its a fine move. Also would make me move from cordova to capacitor so theres that :smile: Thank you anyways and heres to you :man-cartwheeling: get better! :beers:
Sounds like a good plan, migrating was a pia
And thanks, I’m starting to feel better just slept for 32 hours lol
Dang lol, feels like a great plan but at some point, your back would sore wouldnt it?
Sometimes you just gotta sleep for 2 days!
Hey Jay, mind if I bother you up with some questions?