tangokhi
tangokhi

Reputation: 1015

ngUpgrade with Angular-cli

I have a hybrid AngularJS (1.7.0) and Angular 6 app. I am also using @angular/upgrade module to upgrade/downgrade components and services. I have got it working using custom webpack but now I want move towards angular-cli.

Can anyone suggest the best approach to do that.

I am thinking :-

Move Angular 6 to Angular Cli and build AngularJS using custom webpack. But I am not sure what will happen when we navigate between the upgraded/downgraded components.

Upvotes: 0

Views: 791

Answers (1)

Yennefer
Yennefer

Reputation: 6234

angular-cli hides webpack configuration by default (which you can access by using the eject command).

Switching from your configuration to the angular-cli is not trivial if you heavily customized webpack. We migrated several projects via ngUpgrade and component marshalling between angular and angularjs didn't break.

We had several issues in traslating all the heavy-configured webpack tasks. In the end, we successfully migrated all the projects by creating brand new projects with angular-cli and importing only our code, this approach had these pros:

  • brand new configuration files created with good defaults
  • the whole application is working out of the box, therefore user code can be plugged incrementally without minimal (if any) configuration changes
  • tslint configured with the latest defaults
  • all extraneous or dangling configuration files are not part of the new project, this means that you have less code to investigate when you have issues

It took some time to incrementally plug the code, but once the skeleton was working, the task became straightforward. This approach builds both angular and angularjs with the same typescript compiler, without webpack.

Upvotes: 2

Related Questions