angular-cli
angular-cli copied to clipboard
Can't build an app shell and prerender at the same time, each builds overwrites one another.
🐞 Bug report
Command (mark with an x
)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] extract-i18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
No.
Description
Running prerender runs browser and server builds, the same with running app-shell. It overwrites one another, both of these features are very impactful to a website. Both run separate builds so technically they will overwrite each other and won't be able to use alongside each other. I can't search for a way/workaround to run them simultaneously, I also can't find hints on prerender/app-shell docs. I need both of these features on my app, this is an issue on my part. Need help.
🔬 Minimal Reproduction
-
ng run my-app:app-shell && ng run my-app:prerender
-
ng run my-app:prerender && ng run my-app:app-shell
🔥 Exception or Error
N/A
🌍 Your Environment
Angular CLI: 14.1.0
Node: 14.18.1
Package Manager: npm 6.14.15
OS: win32 x64
Angular: 14.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1401.0
@angular-devkit/build-angular 14.1.0
@angular-devkit/core 14.1.0
@angular-devkit/schematics 14.1.0
@nguniversal/builders 14.0.3
@nguniversal/express-engine 14.0.3
@schematics/angular 14.1.0
rxjs 7.5.6
typescript 4.7.4
Anything else relevant?
N/A
I'm also interested in this. I found out that there is one catch. I'm using prerendering for the homepage on route "/", so it uses index.html. My hosting config rewrites all routes to index.original.html, which is created during prerendering (only contains app-root), so it works perfectly for SPA, and it doesn't blink my prerendered homepage on page load. But if I wanted to use the app shell, a different solution would have to exist since the app shell is rendered to index.html by default. It could render the app shell to a different file, e.g., index.shell.html which could be used for rewriting all routes that don't match any prerendered static file.
I'm not sure how they would enable running both without overwriting each other. I suggest maybe we can run prerender and app-shell stacking on one another and on top of the server and browser builds. And remove the server and browser builds upon running prerender/app-shell.
-
ng run my-app:build
-
ng run my-app:server
-
ng run my-app:prerender
/ng run my-app:app-shell
-
ng run my-app:app-shell
/ng run my-app:prerender
Or maybe a single command with browser and server targets?
ng run my-app:app-shell-prerender
/ ng run my-app:prerender-app-shell
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
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.