I'm using Angular universal with Angular 9 and Angular Fire 6.
I managed to prerender my application with npm run prerender
without any errors.
My routes get pre rendered and the index.html
files looks fine.
Except the command itself, it never finishes.
The last lines i get:
...
Prerendering 4 route(s) to {{projekt URL}}\browser
CREATE {{projekt URL}}\browser\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\home\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\edit\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\login\index.html (66857 bytes)
I had the same problem and found out, that somehow the forked process(es) did not terminate correctly. I didn't know how to help but use a small workaround, which I'll execute as NPM script before the actual prerendering:
"prerender:fix-exit": "sed -i -e \"s/}))().then().catch();/}))().then(()=>process.exit(0)).catch(()=>process.exit(1));/g\" ./node_modules/@nguniversal/builders/src/prerender/render.js",
It will basically call process.exit(0)
in case of success, or process.exit(1)
in case of error. In theory, this should also work with a builder configuration of numProcesses
> 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With