-
Notifications
You must be signed in to change notification settings - Fork 478
Prerender doesn't use the build options setting for the default "index.html" name #1585
Description
🐞 Bug report
Prerender builder seems to ignore the build options setting the default "index.html" name/location.
What modules are related to this issue?
- builders
Is this a regression?
No
Description
From what I've seen the prerender
🔬 Minimal Reproduction
- Rename your
index.htmlto something else, for example:index.original.html - Set the correct name in
angular.jsonconfiguration forprojects.name.architect.build.options.index- in this case
"index": "src/index.original.html",
- in this case
- Try to prerender your application
🔥 Exception or Error
An unhandled exception occurred: ENOENT: no such file or directory, open 'C:\Users\user-name\WebstormProjects\my-project\dist\browser\index.html'
This is expected as dist\browser\index.html does not exist, but dist\browser\index.original.html does.
Possible solution
Replacing browserIndexOutputPath at line https://github.com/angular/universal/blob/f0a78c4792ebd6e4e920cda60552be123f7c6810/modules/builders/src/prerender/index.ts#L111
with path.join(outputPath, 'index.original.html') seems to fix the error, but only the "default" route is rendered and I don't even have it specified in routes I want to render.
It would be ideal if the prerender builder respected the setting set in the build options.
I'm open to PR but I need guidance determining the best solution and on how to get the builder options to the _renderUniversal function.
🌍 Your Environment
Angular CLI: 9.1.0
Node: 12.16.1
OS: win32 x64
Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.6
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.0.6
@angular-devkit/schematics 9.1.0
@angular/cdk 9.2.0
@angular/flex-layout 9.0.0-beta.29
@ngtools/webpack 9.1.0
@nguniversal/builders 9.0.2
@nguniversal/common 9.0.2
@nguniversal/express-engine 9.0.2
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.4
typescript 3.8.3
webpack 4.42.0