angular-architects / module-federation-plugin

MIT License
736 stars 203 forks source link

Error "The document object is not available" with Angular 19 with SSR and @angular-architects/native-federation 18.2.3 #704

Open hal1984 opened 1 day ago

hal1984 commented 1 day ago

Reproduction step:

create new angular project: ng new shell --ssr add native federation: ng add @angular-architects/native-federation --project shell --type dynamic-host --port 4200 run the project: npm run start

Expected result:

The application launch

Current result:

ng serve fails on open webpage with "The document object is not available"

Stackblitz with error:

https://stackblitz.com/~/github.com/hal1984/shell

hal1984 commented 1 day ago

As further investigation I am pretty sure that the problem was introduced here:

https://github.com/angular/angular/pull/58386

when the check Is isPlatformBrowser was replaced for the global variable ngServerMode.

manfredsteyer commented 15 hours ago

Thanks for pointing this out. This seems to be an issue with provideClientHydration -- if you skip this option in your app.config.ts it works. We will further look into this issue.