ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

New Ionic 5 project is using Angular 8 instead of Angular 9

Open mustafa-acar opened this issue 6 years ago • 12 comments

Description: I have just upgraded Node JS, npm, angular-cli and ionic cli to the latest and stable versions and created a new project with ionic start new-project blank command.. I expected to see Angular 9 dependencies in package.json file but all Angular dependencies are for 8.2.14 version.

I tried to run npm i @ionic/angular@latest --save command on an existing project and it installed 8.2.14 version again.

As I know the IVY renderer came with Angular 9. Angular 9 has other features like "entryComponents" etc.

My questions are: Does Ionic 5 with Angular 8 dependencies have these features? Should I continue developing or wait.

My ionic info:

Ionic:

   Ionic CLI                     : 6.1.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.0
   @angular-devkit/build-angular : 0.803.25
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.25
   @ionic/angular-toolkit        : 2.1.2

Capacitor:

   Capacitor CLI   : 1.5.0
   @capacitor/core : 1.5.0

Utility:

   cordova-res                          : not installed
   native-run (update available: 0.3.0) : 0.2.8

System:

   NodeJS : v12.16.0 (/usr/local/bin/node)
   npm    : 6.13.7
   OS     : macOS Catalina

Other Information:

mustafa-acar avatar Feb 13 '20 12:02 mustafa-acar

I'm awaiting an outcome on this, I have read elsewhere that Ionic are aware of the issue which is some breaking change to do with the Angular routing causing Ionic to fail. It would be good to have an update on this to see where to take developments at this stage.

ChelloApps avatar Feb 17 '20 10:02 ChelloApps

Angular versioning vs its ecosystems is what bothers me the most! When Ionic Team releases a new version of the Framework, it's immediately made obsolete by the Angular's new version.

gilbertoalbino avatar Feb 22 '20 22:02 gilbertoalbino

👋 Hey everyone! Ionic v5 apps DO support Angular 9. You can update your apps without issue as seen here

https://www.youtube.com/watch?v=851HkqX3YQ4&

We currently default to Angular 9 at the moment for a few reasons:

  • V9 enables Ivy by default, which could affect other libraries or packages in a project. Instead of providing the latest which the ecosystem is still updating to, we provide at least something we know for a fact will workout issue.

  • V5 of ionic was released a week about ng9, which is a pretty tight window. While we knew v5 worked fine with ng9, there were other things that required attention. Plus, the migration process isn't difficult.

@gilbertoalbino it's important to know that Angular v8 is not obsolete... it is in fact in LTS mode per angular's release schedule.

mhartington avatar Feb 25 '20 20:02 mhartington

Just in case someone needs the steps and for completeness on what @mhartington said above. I done the following to update the a default blank project: ionic start myApp blank --capacitor --type=angular

  1. ionic start myApp blank --capacitor --type=angular
  2. cd myApp
  3. ng update @angular/core @angular/cli
  4. Using ncu -i I updated everything except: [core-js, tslint, typescript]
  5. I removed core-js from package.json completely
  6. npm prune

P.S. I would really like to see how TSLint can also be replaced with ESLint.

andronat avatar Feb 25 '20 20:02 andronat

@mhartington

We currently default to Angular 9 at the moment for a few reasons

Do you mean that you currently default to Angular 8 instead?

jayordway avatar Mar 25 '20 05:03 jayordway

@mhartington

We currently default to Angular 9 at the moment for a few reasons

Do you mean that you currently default to Angular 8 instead?

Yes. Ionic is still targeting Angular 8.

wrosb avatar Mar 25 '20 20:03 wrosb

@mhartington

We currently default to Angular 9 at the moment for a few reasons

Do you mean that you currently default to Angular 8 instead?

Yes. Ionic is still targeting Angular 8.

I understand that, I was just saying it is a typo above.

jayordway avatar Mar 26 '20 02:03 jayordway

@mhartington

We currently default to Angular 9 at the moment for a few reasons

Do you mean that you currently default to Angular 8 instead?

Yes. Ionic is still targeting Angular 8.

Confirm. my angular version : Angular CLI: 9.1.0 Node: 12.14.1 OS: win32 x64 ionic cli version : CLI 6.3.0 with a new starting blank template, project has target angular8. "@angular/common": "~8.2.14", "@angular/core": "~8.2.14", "@ionic-native/core": "^5.0.0",

timsar2 avatar Mar 26 '20 13:03 timsar2

We currently default to Angular 9 at the moment for a few reasons: it is in fact in LTS mode per angular's release schedule.

Hi. So Ionic 5 defaults to Angular 8, not 9, right? If so, I think it would be best to edit that message (the one I'm quoting here) to avoid confusion :).

karol-depka avatar Apr 09 '20 04:04 karol-depka

You can update your apps without issue as seen here https://www.youtube.com/watch?v=851HkqX3YQ4&

Also, link to the specific time in the video, for those who might want to go directly to the part about upgrading to Angular 9: https://youtu.be/851HkqX3YQ4?t=243

karol-depka avatar Apr 09 '20 05:04 karol-depka

Is it the version of the CLI that decides which version of angular a project will be created with? I'm on CLI 6.18.1 and when I create a blank project, it defaults to Angular 5.

bradeaton avatar Nov 30 '21 01:11 bradeaton

@bradeaton - no. It is the starter: https://github.com/ionic-team/starters

ionic start <project-name> <template> --type=angular|react|vue (at least for modern versions of Ionic).

So, if you do ionic start foo-bar blank --type=angular it will use NG 12 as specified in the base package here: https://github.com/ionic-team/starters/blob/main/angular/base/package.json, and then add merge that with the "blank" bits here: https://github.com/ionic-team/starters/tree/main/angular/official/blank

You are (apparently) specifying Ionic v3 (ionic-angular) which will get you an old and unsupported version of Ionic whose last officially supported version of Angular was NG 5. You shouldn't really want that, but if you do we still allow it and it will use the files under here: https://github.com/ionic-team/starters/tree/main/ionic-angular

Heck you could even do Ionic v1 if you wanted: https://github.com/ionic-team/starters/tree/main/ionic1

But it is all from the starters.

It is good to keep your CLI up to date, as then you get the latest features of the CLI, but the starting point of any generated project is determined by the starter that you use.

Hopefully that all made sense.

kensodemann avatar Nov 30 '21 02:11 kensodemann