gpt4 book ai didi

Angular 2 AOT - 带有第三方库

转载 作者:行者123 更新时间:2023-12-02 03:37:58 25 4
gpt4 key购买 nike

我在我的 Angular 2 应用程序中使用 Highcharts 和 Kendo Charts,当我尝试运行 AOT 编译时,它会抛出类似的错误

Cannot Import Module

HomeModule' is not exported by

Cannot Determine Module ..

我开始知道我应该为所有第三方文件导入 .metadata.json 文件。

如何创建它们?或者在哪里可以找到它们?或者如果任何第三方库都没有这样的文件该怎么办?

最佳答案

Per @angular issue comment:

All referenced, 3rd party libraries must include the .metadata.json file along side any .d.ts files they produce otherwise they will not work correctly with ngc. The .metadata.json file contains the information we need that was in the original .ts file but was not included in the .d.ts file. If we don't have that information we cannot generate the factories for the library.

The .metadata.json files are produced automatically by ngc. They should be built and delivered by the library vendor and require the .ts files.

如果您要使用的第 3 方依赖项未随 metadata.json 文件一起提供,您可以尝试自己使用 ngc 构建它,但这样做可能会<不简单。当 tsc 不这样做时,ngc 可能会失败并出现错误,可能是因为代码不是 statically analyzable .

关于Angular 2 AOT - 带有第三方库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41147186/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com