-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canonical setup for Angular Universal cannot currently be converted to Nx Workspace #135
Comments
With the Angular CLI 6 supporting multiple apps, should this no longer be an issue now? anyone tried Server side rendering for nx apps? |
@a5hik It would appear it's not working. |
@a5hik My nx workspace has 3 apps which all support SSR. I don't believe there is any question of support for SSR in NX, this issue is discussing how to convert an existing, non-nx monorepo, that contains multiple apps within
Apparently, converting an existing monorepo to nx doesn't work if the monorepo already has multiple projects within it (which will be the case for apps with SSR). In my case, I created the nx workspace first, then added apps with SSR to it, so I never encountered this problem. To see a working nx + SSR setup, you can check out this very helpful starter repo https://github.com/beeman/angular-nx-ssr. Note: I don't think the repo has been updated to use CLI v6 |
@thefliik hey - glad to hear my repo has been useful! I will update it one of these days with the latest versions of Angular + NX |
This works more now with Nx6. ng new universalproject
cd universalproject
ng g universal --client-project universalproject
ng add @nrwl/schematics This should mostly work after a coming release. Something you might have to tweak yourself for now is the server configuration in architect. The paths aren't updated which I will handle soon. You may also want to move the The server configuration should look like - "server": {
- "builder": "@angular-devkit/build-angular:server",
- "options": {
- "outputPath": "dist/uniproject-server",
- "main": "src/main.server.ts",
- "tsConfig": "src/tsconfig.server.json"
- }
- }
+ "server": {
+ "builder": "@angular-devkit/build-angular:server",
+ "options": {
+ "outputPath": "dist/apps/universalproject-server",
+ "main": "apps/universalproject/src/main.server.ts",
+ "tsConfig": "apps/universalproject/tsconfig.server.json"
+ }
+ } |
@FrozenPandaz #543 new error when ng add @nrwl/schematics |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
We do not support converting projects which have multiple apps within their .angular-cli.json file.
In the case of Angular Universal, the currently recommended way to configure it is to have a second app for the server-side aspect of your application (be that pre-rendering or request time SSR).
This effectively means that apps which have been set up to do pre or server-side rendering cannot easily be converted to use Nx as it stands.
Reference from Angular CLI documentation:
https://github.com/angular/angular-cli/wiki/stories-universal-rendering#step-3-create-a-new-project-in-angular-clijson
Whilst going through this process myself, I also discovered #134.
The text was updated successfully, but these errors were encountered: