DEV Community


Discussion on: Steps for upgrading AngularJS to Angular 9

devtronic profile image
Julian Finkler • Edited

Tips for migrating AngularJS to Angular 9:

  • Never ever reference Angular code from AngularJS and vice versa. Otherwise the bundling process will not work properly and ends with big fat bundles which bootstraps slow.
  • Use lazy loading in Angular
  • Don't use a vendor bundle since Angular knows how to split the bundles efficiently
  • Big bundles / slow bootstrapping? Use webpack bundle analyzer to analyze the bundle
  • Shared types? Use a *.d.ts file

@psamim :
You should remove
import { angularJsModule } from "../ajs/app";

and use this instead (directly in ngDoBootstrap):

import('../ajs/app').then((angularJsModule) => {
    // do the bootstrapping stuff here

This enables lazy loading and splits the AngularJS in a separate bundle.

psamim profile image
Samim Pezeshki Author

Thanks! I'll apply your tips here and report the results.

Forem Open with the Forem app