*.ngsummary.json 的目的是什么

What is the purpose of *.ngsummary.json

我刚刚了解 AOTngc 等。在 运行 ngc 之后我看到很多 *.ngsummary.json(在 src 文件夹,位于 *.ts 个文件旁边)。

它们有什么用?

这显然是AOT编译器使用的NgFactory文件的新名称。在此页面上搜索 NgFactory Ahead-of-Time Compilation

摘录:

After ngc completes, look for a collection of NgFactory files in the aot folder. The aot folder is the directory specified as genDir in tsconfig-aot.json.

These factory files are essential to the compiled application. Each component factory creates an instance of the component at runtime by combining the original class file and a JavaScript representation of the component's template. Note that the original component class is still referenced internally by the generated factory.