Closed asgerjensen closed 11 months ago
This is expected as when pre-rendering the AppServerModule
is used directly. As such it is recommended that you configure the server only providers in there and only configure providers in ngExpressEngine
where you need to provide values from the request/response or other providers that override the once configured in AppServerModule
.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
🐞 Bug report
What modules are related to this issue?
Is this a regression?
Unknown
Description
Unable to pass
extraProviders
for prerender worker, like i can for Engineshttps://github.com/angular/universal/blob/5974f8e769e75023cacbf0cc52f7c1a6ae534f45/modules/builders/src/prerender/worker.ts#L98-L103
vs
https://github.com/angular/universal/blob/5974f8e769e75023cacbf0cc52f7c1a6ae534f45/modules/common/engine/src/engine.ts#L96-L100
🔬 Minimal Reproduction
In the server-app-module, read a
Provide this in the engine in server.ts
...
This value is available in the
app.server.module.ts
But when running prerender, it does not use the engine. It just imports the AppServerModule from
main.js
, so any configuration done via extraProviders is lost.Maybe, since the prerender worker is just grabbing expected exports from main.js, it could just be supported that it looked for an export called rootExtraProviders or some such, which would be an array of
StaticProvider
?🔥 Exception or Error
🌍 Your Environment