Skip to content

Commit 66ab573

Browse files
Kiougarwardbell
authored andcommitted
docs(cookbook-aot-compiler): improve Ahead-of-Time compilation cookbook
Add additions/clarification: * Add `main-aot.ts` and `main.ts` comparison in the key differences. * Add a sub note below `tsconfig-aot.json` and `tsconfig.json` comparison to highlight and explain the usage of `../../node_modules/@types/` instead of `node_modules/@types/`.
1 parent 75464d5 commit 66ab573

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

public/docs/ts/latest/cookbook/aot-compiler.jade

+28-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ a#toh
341341

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

344-
***Index.html***
344+
***index.html***
345345

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

364364
The AoT version loads the entire application in a single script, `aot/dist/build.js`.
365365
It does not need `SystemJS` or the `reflect-metadata` shim; those scripts are absent from its `index.html`
366+
367+
***main.ts***
368+
369+
The JiT and AoT apps are also bootstraped differently that they require their own `main.ts` files.
370+
Here they are for comparison:
371+
372+
+makeTabs(
373+
`toh-6/ts/app/main-aot.ts,
374+
toh-6/ts/app/main.ts`,
375+
null,
376+
`app/main-aot.ts (AoT),
377+
app/main.ts (JiT)`
378+
)
379+
380+
:marked
381+
They can and should exist in the same folder.
382+
383+
The `app/main-aot.ts` file is used by the AoT config scripts (`tsconfig-aot.json` and `rollup-config.js`).
384+
385+
Key differences are discussed in the [Bootstrap](#bootstrap) section, above.
366386

367387
*Component-relative Template URLS*
368388

@@ -396,6 +416,13 @@ a#toh
396416
tsconfig.json (JiT)`
397417
)
398418

419+
.l-sub-section
420+
:marked
421+
_Note_ that the specific file structure of this project needs `typeRoots` to include `../../node_modules/@types/`,
422+
whereas in a typical setting it should include `node_modules/@types/` instead.
423+
424+
Make sure to edit accordingly to your project needs.
425+
399426
:marked
400427
### Tree Shaking
401428

0 commit comments

Comments
 (0)