-
Notifications
You must be signed in to change notification settings - Fork 220
"Identifier 'ngServerMode' has already been declared" when prerender is true #795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I managed to fix the issue for the default SSR with prerender: true changing in the following file: the method function setNgServerMode() to:
|
I have created a PR to fix the issue about prerendering with the default SSR: When using the new angularAppEngine / Server Routing stills the builds fails, but I think that is a different issue:
but with the default SSR now runs ok:
|
Thanks. But did prerender work after that change? IMHO pretender is not supported currently by NF |
Prerendering works, but only with the fallback option in the loadRemoteModule function within the route array; otherwise, it fails with an "Unknown remote " error. The remotes aren't loaded yet because initNodeFederation has not been called by that point. As a result, the prerendered HTML files do not contain any remote code, only the fallback one. I tried calling it earlier, before the prerendering process starts rendering the routes, during the bootstrap process in main.server.ts. However, it fails because dist/browser has not been compiled yet. At least, that's what I have been able to test. |
I have created a fresh nx project with a host and remote for angular based on your guidelines still there is an error. the shell builds fine but the remote fails |
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
https://github.com/hal1984/native-federation-19/tree/ngServerMode
The build crash with the following output:
Expected behavior
Build succeeds
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
Native Federation: 19.0.16
Angular: 19.2.2
Node: 22.14.0
Browser: Chrome
Operating systems: macOS Sequoia
Other information
For MFE1 the new Server Routing have been used.
https://angular.dev/guide/hybrid-rendering.
For shell the default SSR with "prerender": "true" have been used. Both appear to fail with the same error.
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: