Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(cookbook-aot-compiler): improve Ahead-of-Time compilation cookbook #2790

Closed
wants to merge 1 commit into from
Closed
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
29 changes: 28 additions & 1 deletion public/docs/ts/latest/cookbook/aot-compiler.jade
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ a#toh

Fortunately, the source code can be compiled either way without change _if_ you account for a few key differences.

***Index.html***
***index.html***

The JiT and AoT apps are setup and launched so differently that they require their own `index.html` files.
Here they are for comparison:
Expand All @@ -363,6 +363,26 @@ a#toh

The AoT version loads the entire application in a single script, `aot/dist/build.js`.
It does not need `SystemJS` or the `reflect-metadata` shim; those scripts are absent from its `index.html`

***main.ts***

The JiT and AoT apps are also bootstraped differently that they require their own `main.ts` files.
Here they are for comparison:

+makeTabs(
`toh-6/ts/app/main-aot.ts,
toh-6/ts/app/main.ts`,
null,
`app/main-aot.ts (AoT),
app/main.ts (JiT)`
)

:marked
They can and should exist in the same folder.

The `app/main-aot.ts` file is used by the AoT config scripts (`tsconfig-aot.json` and `rollup-config.js`).

Key differences are discussed in the [Bootstrap](#bootstrap) section, above.

*Component-relative Template URLS*

Expand Down Expand Up @@ -396,6 +416,13 @@ a#toh
tsconfig.json (JiT)`
)

.l-sub-section
:marked
_Note_ that the specific file structure of this project needs `typeRoots` to include `../../node_modules/@types/`,
whereas in a typical setting it should include `node_modules/@types/` instead.

Make sure to edit accordingly to your project needs.

:marked
### Tree Shaking

Expand Down