问题标签 [angular2-aot]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1967 浏览

angular - Angular 2 引导选项 - AOT 与 JIT

刚刚开始使用 Angular 2。

  1. 角度 2 中的各种引导选项是什么?

  2. 为什么当我进行更改并刷新 index.html 时检索 HTML 标记需要很少的时间?

  3. 它们之间的差异

0 投票
1 回答
169 浏览

angular - Angular 2:Aot 不生成应用程序文件夹

我已经在我的 Angular 2 项目中实现了 aot,最终解决了所有错误

运行成功,但我在 aot 文件夹中只看到 node_modules 文件夹,其中没有 app 文件夹。那么我在哪里可以让AppModuleNgFactory 引导它呢?

0 投票
0 回答
246 浏览

javascript - 编译生产版本时的Angular2 AOT问题 - 应用程序模块问题

编译生产版本时的Angular2 AOT问题 - 应用程序模块问题

我正在使用 angular2、typescript、html5 和 systemjs

这是我正在使用的 angular2 种子应用程序:https ://github.com/mgechev/angular-seed

当我执行这个 git bash 命令时: npm run serve.prod.exp 为 AOT 创建一个构建包。然后我在 git bash 中遇到错误。

这是我得到的错误 AOT 构建错误:

在此处输入图像描述

这是我的 app.module:

*如果您需要查看我的应用程序中的更多代码,请告诉我。

我只想构建这个应用程序,这样我就可以在 AOT 中运行它,并在应用程序首次加载时获得快速加载时间。目前它的加载时间为 4 秒。

应用路线:

这是带有引导程序的主文件:

0 投票
1 回答
558 浏览

angular - Angular Aot:未生成应用文件夹

我已经在我的 Angular 2 项目中实现了 aot,最终解决了所有错误

运行成功,但我只看到 aot 文件夹中的 node_modules 文件夹,而其中没有 app 文件夹。那么我在哪里可以让 AppModuleNgFactory 引导它呢?

这是我的tsconfig-aot.json文件

0 投票
0 回答
226 浏览

angular - Angular 2 Aot 错误:错误:ENOENT:没有这样的文件或目录,lstat

在 angular 2 中执行 aot 时,解决了所有问题并最终出现此错误

没有什么错误。

0 投票
2 回答
909 浏览

angular - Angular 2 Aot 错误:“ToastsManager”未导出

在执行 AOT 时,我遇到了我正在使用的 ng2-toastr 的问题

关于如何解决这个问题的任何想法?我检查了所有提到的文件,他们有出口声明关键字,甚至检查了这个网站

https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module

0 投票
0 回答
76 浏览

angular - Angular2种子项目aot编译没有生成ngfactory文件

我根据官方教程创建了一个angular2 aot种子项目,但是ngc编译不生成ngfactory文件。

你能帮我看看可能是什么原因吗?

项目站点:https ://github.com/petermezei/angular2-aot-webpack-website-seed

该项目非常非常小,只是为了检查可能出现的问题。

我使用的 Ngc 命令:node_modules/.bin/ngc -p tsconfig.aot.json

提前谢谢你,彼得 Mezei。

0 投票
1 回答
262 浏览

angular - Angular 2 AOT 功能错误

当我尝试将 Ionic 2 应用程序部署到我的 android 设备时,我收到以下错误:

错误:静态解析符号值时遇到错误。不支持函数调用。考虑将函数或 lambda 替换为对导出函数的引用,在 /Users/ibnclaudius/Development/egglr/egglr-mobile/.tmp/reducers/index.ts 中解析符号缩减器,在 /Users/ibnclaudius/Development 中解析符号 AppModule /egglr/egglr-mobile/.tmp/app/app.module.ts,解析符号AppModule在/Users/ibnclaudius/Development/egglr/egglr-mobile/.tmp/app/app.module.ts

index.ts(给出错误的代码部分)

0 投票
2 回答
248 浏览

angular - 提前编译问题

我使用了 AHEAD-OF-TIME 编译,编译 AOT 文件夹成功生成后,但在 app.modulengfactory.ts 文件中出现问题,它会引发错误,例如 Build:Generic type 'HttpService' requires 1 type argument(s)。当我构建项目时

我的 app.Module.ts 文件如下

我认为问题是我没有在接受泛型类作为参数的 httpservice 中传递参数。

我的 Http 服务如下

所以请给我任何建议我该如何解决这个问题。

0 投票
0 回答
114 浏览

angular - 使用 AOT 编译生成 Angular 2 Production-“文件夹”

我有一个 Angular2 应用程序,它在具有 jit 和 aot 编译的 lite 服务器上本地运行。

对于 aot,我遵循了https://angular.io/docs/ts/latest/cookbook/aot-compiler.html上的教程。现在我想在 apache 服务器上托管应用程序。但是,我的项目中似乎存在一些配置问题。我有已编译的 aot 文件夹,其中包含子文件夹 node_moduels 和 app + dist/build.js。到目前为止,一切都很好。我认为将文件夹 aot + dist 和文件 index.html(在教程中引用 build.js)+ styles.css 复制到 apache 服务器应该可以。但是,这会在运行应用程序时导致错误的引用。

对于 index.html 中引用的所有文件,我得到 404,例如: http://apacheserverurl/dist/build.js

当我在浏览器中手动打开 index.html 时,也会出现同样的问题。因为我编译了所有的 javascript 和 html 文件,这不应该工作吗?

任何帮助深表感谢。