universal: Express Engine returns a 'file not found' error with Angular 9 RC 1, Universal Next 6
Bug Report
When serving requests using the express engine and a ServerAppModule built with CLI/Core 9 RC1, the express engine callback contains an error that the component template file cannot be found.
What is the expected behavior?
Engine returns HTML
What is the current behavior?
Engine returns the following error:
Error: ENOENT: no such file or directory, open 'auth-to-contribute.component.html'
(where the component file is part of the ServerAppModule).
What modules are related to this issue?
- [ ] aspnetcore-engine
- [ ] common
- [X] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Minimal reproduction with instructions:
Don’t have a minimal repro case unfortunately.
Environment:
@nguniversal versions
- aspnetcore-engine:
- common:
- express-engine:
- hapi-engine:
- module-map-ngfactory-loader:
Angular CLI: 9.0.0-rc.1
Node: 12.12.0
OS: darwin x64
Angular: 9.0.0-rc.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.1
@angular-devkit/build-angular 0.900.0-rc.1
@angular-devkit/build-optimizer 0.900.0-rc.1
@angular-devkit/core 9.0.0-rc.1
@angular-devkit/schematics 9.0.0-rc.1
@angular/cdk 9.0.0-rc.0
@angular/material 9.0.0-rc.0
@nguniversal/common 9.0.0-next.6
@nguniversal/express-engine 9.0.0-next.6
@nguniversal/module-map-ngfactory-loader 9.0.0-next.6
@schematics/angular 8.0.0
@schematics/update 0.900.0-rc.1
rxjs 6.5.3
typescript 3.6.4
webpack 4.40.2
Is there anything else we should know?
I started following the stacktrace for where this error is triggered, and it seems to be the if block in _preParseTemplate
in directive_normalizer.ts
(it ultimately fails to fetch the template). Interestingly, this doesn’t appear to be a problem for library component templates (Material2 components don’t try to fetch the template as its part of the PrenormalizedTemplateMetadata
). For the components internal to my app, however, it tries and fails to find them on the filesystem.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 30 (1 by maintainers)
Progress! When I change the
postinstall
script to:ngcc --properties es2015 browser module main
and keepbundleDependencies: "none"
andoptimization: true
, requests no longer return an error. I get a new error that seems to prevent page from actually rendering on the server, but it appears unrelated to this issue:So, if I’m not bundling dependencies (which I’d prefer not to for build speed and such), it seems I’ll need to keep the postinstall script as it is above?