1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular app not bootstrapping after NX migration to v20.5.0

Discussão em 'Angular' iniciado por anvyn, Julho 1, 2025.

  1. anvyn

    anvyn Guest

    I'm migrating an Angular monorepo managed by NX. After running: npx nx migrate 20.5.0

    Everything completed without errors, and the app starts (no errors in the terminal or browser console), but it never bootstraps — the root component doesn't render.

    Here's my AppModule for the main shell app:

    imports: [
    BrowserModule,
    BrowserAnimationsModule,
    RouterModule.forRoot(routes),
    SpCDKModule.forRoot(),
    SpHttpModule.forRoot('PG', configs.pg.http),
    SpConnectorModule.forRoot('shell'),
    WrapperComponent,
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent],
    providers: [GetUserInfo],
    })
    export class AppModule {}


    Here's my main.ts:

    import { setRemoteDefinitions } from '@nx/angular/mf';

    console.log('MAIN - fetch start');
    fetch('/module-federation.manifest.json')
    .then((res) => {
    console.log('MAIN - manifest fetched');
    return res.json();
    })
    .then((definitions) => {
    console.log('MAIN - setting remote definitions', definitions);
    setRemoteDefinitions(definitions);
    })
    .then(() => {
    console.log('MAIN - importing bootstrap');
    return import('./bootstrap');
    })
    .catch((err) => console.error('MAIN - error loading bootstrap', err));



    And here's bootstrap.ts:

    import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
    import { AppModule } from '@shell/app.module';

    console.log('BOOTSTRAP - starting platformBrowserDynamic');

    platformBrowserDynamic()
    .bootstrapModule(AppModule)
    .then(() => console.log('BOOTSTRAP - RESULT'))
    .catch((err) => console.error('BOOTSTRAP - error', err));


    The last log I see is: MAIN - importing bootstrap

    There’s no output from bootstrap.ts, not even the first log line.

    Any idea what could prevent import('./bootstrap') from resolving or executing after a seemingly successful migration?

    Continue reading...

Compartilhe esta Página