A minimum project to learn aot with Angular5ngc
and rollup. Also demonstrate how to import 3rd lib such as jQuery.
This project use ngc
to generate compiled Angular code and write it to disk, and then bundle the js code from disk. This make you be able to observe the code generate by angular compiler, and even edit it to see the difference! I think it is really helpful to understand & play with the "low-level machine code" of Angular.
npm run compile
: usengc
to compile the "angular syntax" into js. You can observe the output incompile_output/
.npm run rollup
: rollup the whole application(including application code, angular framework, 3rd lib, except lazy-loading modules) into one file:serve/rollup-output.js
.npm run serve
: copy the necessary files into theserve/
directory, and serve this folder with lite-server.npm run clean
: cleancompile_output/
andserve/
.npm run aot
: "npm run clean && npm run compile && npm run rollup && npm run serve".
- skipMetadataEmit in
src\tsconfig.app.json
determine whether or not Angular Compiler emit.metadata.json
files. - skipTemplateCodegen in
src\tsconfig.app.json
determine whether or not Angular Compiler emit.ngfactory.js
and.ngstyle.js
files. declaration
intsconfig.json
determine whether or not TypeScript Compiler emit.d.ts
definition files.sourceMap
intsconfig.json
determine whether or not TypeScript Compiler emit.js.map
sourcemap files.