Skip to content
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

[JSS] [Angular] Pull server bundle build improvements #617

Merged
merged 8 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ But it still remains a question where the provider for `@Inject('JSS_SERVER_TO_S

> ### Application bundles
>
> By default an Angular-CLI project will build one bundle for an application. But to support universal rendering Angular-CLI has to be configured to create an additional bundle. [Read more about Angular-CLI and universal rendering](https://github.com/angular/angular-cli/wiki/stories-universal-rendering). Lets call these two bundles the _universal bundle_ and the _client bundle_ respectively.
> By default an Angular-CLI project will build one bundle for an application. But to support universal rendering Angular-CLI has to be configured to create an additional bundle. [Read more about Angular-CLI and universal rendering](https://github.com/angular/angular-cli/wiki/stories-universal-rendering). Lets call these two bundles the _server bundle_ and the _client bundle_ respectively.
>
> Both the universal bundle and client bundle cannot run on their own, they need to be served. To be able to serve these bundles a server is needed. JSS comes with a JavaScript view engine for Node that can run our universal bundle. The JSS JavaScript view engine expects a Node bundle that exports a `renderView` function, and to deliver this a third bundle is created that we will name _server bundle_. The server bundle is not built using Angular-CLI but is instead a custom webpack project.
> Both the server bundle and client bundle cannot run on their own, they need to be served. To be able to serve these bundles a server is needed. JSS comes with a JavaScript view engine for Node that can run our server bundle. The JSS JavaScript view engine expects a _server bundle_ that exports a `renderView` function.
>
> _Summary_: The BasicAppAngular application builds three bundles into the `dist` folder:
> _Summary_: The BasicAppAngular application builds two bundles into the `dist` folder:
>
> * Client bundle - located in `dist/client/`
> * Universal bundle - located in `dist/server/`
> * Server bundle - located at `dist/server.bundle.js`

To understand where the data comes from find `server.bundle.ts`. The data is served from JSS's view engine via the `renderView` function which is located in the `server.bundle.ts`.
Expand Down
2 changes: 1 addition & 1 deletion samples/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"main": "server.bundle.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
Expand Down
Loading