You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
application builder: In SSR body of server.ts is not taken into consideration when running ng serve with @angular-devkit/angular-builder:dev-server#26472
Closed
1 task
pawelfras opened this issue
Nov 23, 2023
· 4 comments
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When setting up a new application with SSR on, the development mode (ng serve) doesn't use the content from the server.ts file. It looks like the build process only checks whether the server.ts file exists - even if the file is empty, the build goes through without issues and the app is served but if it's missing, you get an error like this:
✘ [ERROR] TS6053: File '/path/to/your/app/server.ts' not found.
The file is in the program because:
Root file specified for compilation [plugin angular-compiler]
If your app depends on some custom logic written in server.ts, e.g custom providers, injecting those into your app doesn't work right now in dev mode and it throws an error: NullInjectorError: No provider for [your_injectable].
Minimal Reproduction
Minimal reproduction:
ng new test-app --ssr
add console.log to server.ts
ng serve
Message from console.log won't appear in the terminal.
#26323 is concerned with the provisioning of REQUEST and RESPONSE within the context of the Angular stereotypes (component, directive, service, pipe, module).
While in this issue, we are concerned with the development tooling: in Angular v17, the start script runs ng serve which uses the @angular-devkit/build-angular:dev-server builder as specified in the angular.json. Here is the call stack we are interested in for this builder:
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When setting up a new application with SSR on, the development mode (
ng serve
) doesn't use the content from theserver.ts
file. It looks like the build process only checks whether theserver.ts
file exists - even if the file is empty, the build goes through without issues and the app is served but if it's missing, you get an error like this:If your app depends on some custom logic written in server.ts, e.g custom providers, injecting those into your app doesn't work right now in dev mode and it throws an error:
NullInjectorError: No provider for [your_injectable]
.Minimal Reproduction
Minimal reproduction:
server.ts
Message from console.log won't appear in the terminal.
Reproduction of example when you want to provide values in
server.ts
(e.g. as in migration steps from @nguniversal to @angular/ssr)ng new test-app --ssr
server.ts
REQUEST
token e.g. inapp.component.ts
ng serve
After opening the app, you'll see
R3InjectionError
:Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: