问题标签 [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.
webpack - Angular 2 AOT Webpack CSS 相对嵌套 url
我在我的项目中使用Material-Design-Icons,并将它的 css 导入到我自己的 css 文件中。
这是这样做的:
app.component.css
材料设计图标.css
现在,初始导入 (from app.component.css
) 和嵌套导入 ( materialdesignicons.css
) 可以正常使用to-string-loader!css-loader
onwebpack-dev-server
但是,使用Angular 2 编译器 CLI将无法导入嵌套的 url(字体)。
当我看到项目正在尝试获取相对于主 css 文件 ( app.component.css
) 的字体时,我收到 404 错误。
Webpack.common.config.js(加载器)
angular - angular-cli AOT 错误解析符号
我有一个 Angular2 cli 项目(cli 1.0.0-beta.21)
使用 ng build --prod 和 --dev 时,它可以正常构建和运行
但是如果我尝试ng build --prod --aot我会收到以下错误
静态解析符号值时遇到错误。不支持函数调用。考虑将函数或 lambda 替换为对导出函数的引用,解析符号 AppModule
我已经查看了这个 github 问题,但无法弄清楚我哪里出错了。
这是我的 app.module.ts 文件:
我确实使用这样的不透明令牌将一些外部值导入我的应用程序:
这可能是我的问题吗?
问题是我的 app.module.ts 中的这一行
它从以下导入一个值:
我已将以下内容添加到我的 typing.d.ts 文件中
对于上下文:此应用程序必须存在于使用 jquery 函数构建对后端 api 数据的请求的 CMS 中。因此,我需要在我的应用程序中提供该服务,以便为 api 请求获取所需的验证令牌。(我知道这并不理想,但这是必要的。)
问题
如何以适用于 AOT 的方式将此服务注入我的应用程序?
干杯
javascript - Angular 2 Aot:Zoneware (SystemJS) XHR 错误
我正在研究 Angular Ahead of Time Compilation(AoT),在那里我生成了 build.js 文件,并且在加载时遇到了以下问题
包含在 index.html 中的以下文件
angularjs - Angular2 组件是否由 Angular 1 在运行时编译的 ng-upgrade 降级
我使用 ng-upgrade 将我们的 Angular1 应用程序引导为混合应用程序。我有 AOT 正在编译包含 1 个虚拟组件的 Angular2 脚本。我还捆绑了其他文件并在生产模式下运行 Angular2。
作为混合应用程序,我们的应用程序的性能平均比独立的 Angular1 应用程序慢 2.5 秒。(注意这是一个包含很多组件的大型应用程序)
由于下载的额外文件和涉及的额外脚本,我预计性能会受到影响,但影响出人意料
我们计划开始将我们的组件迁移到 Angular2 并降级它们,以便它们可以与 Angular1 一起使用,但我想知道,降级的组件在被 AOT 编译后会再次编译吗?
如果是这种情况,那么在迁移每个组件并且我们放弃 Angular1 之前,我们不会看到性能改进,这是一个很长的路要走。
有没有人走这条路或可以提供一些信息?
angular - Angular2 (Angular.io) AOT 部署到 IIS 8
按照 Angular.io Tour of Heros 示例中概述的步骤,我已经为一个稍微简单的应用程序建模。
https://angular.io/docs/ts/latest/tutorial/
我还根据这个例子实现了 AOT 编译: https ://angular.io/docs/ts/latest/cookbook/aot-compiler.html
直接来自 Angular.io 网站的非常标准的东西。
在我的开发机器上,应用程序的 JIT 版本在 lite 服务器上运行良好。在我的开发机器上,应用程序的 AOT 版本在 lite 服务器上运行良好。
是的!!!世界是有道理的!好的。现在是时候将应用程序移至我的 2012/IIS 8 开发服务器了。粗略地说,在 Angular.io 网站上没有执行此特定任务的说明,因此我必须做出一些假设。
我所要做的就是将 aot 文件夹的内容(基于 aot 示例)复制到我的开发服务器。
由于我不再使用 lite 服务器,因此不需要复制 bs-config.json 文件。
该包已转换为 js、css 和 html 文件。IIS 将知道如何处理所有内容(我希望,我也在那里看到了一些地图扩展。我很害怕)。
果然。我将文件移动到我的开发服务器。这没用。我不确定它是否是由于我需要完成某些步骤才能使 aot 在 IIS 上工作,是简单的还是两者兼而有之。我收到可怕的“意外令牌”错误。当我单击错误链接时,它会将我带到我的 index.html 中引用我的 build.js 文件的位置。
我认为这与 IIS 有关,因为它在使用 lite 服务器的本地计算机上运行良好。
任何帮助或建议将不胜感激。
angular - 我的应用程序的 AoT 版本抛出“未定义要求”
我遵循了官方的 AoT 教程,一切(编译和服务器启动)都正常工作。但是,当我在浏览器上加载应用程序时,出现以下错误:
在 中main-aot.js
,我有以下内容:var platform_browser_1 = require('@angular/platform-browser');
我有点理解为什么会出现此错误...我从不加载任何对 require 函数的支持(我的 JiT 应用程序使用 systemJS),但在本教程中没有提到任何关于 this 的内容require
。请注意,我已经复制了所有的 AoT 文件(main-aot.ts、rollup-config.js 和 tsconfig-aot.json)
我在这里想念什么?
angular - Angular2 AOT 编译器错误,重复标识符 PropertyKey
我正在编译这里描述的我的 angular2 项目 AA: https ://angular.io/docs/ts/latest/cookbook/aot-compiler.html
我正在运行以下命令:node_modules/.bin/ngc -p tsconfig-aot.json
但收到以下错误:node_modules/typescript/lib/lib.es2015.core.d.ts:17:14:重复标识符“PropertyKey”。
Domeinen 有什么idea hoe 来Fixorganisatie hoe 看看这里是declaren 多次吗?
谢谢!
angular - Angular2 AoT - Expression form not supported
I'm trying to use ngc to compile angular 2.4.4:
It looks like it is complaining about how i'm exporting a constant for @ngrx/store.
I tried changing the constant into an exported function... as well as all of the properties.
Previously:
Presently:
I'm using this in my imports[] as such:
Each reducer has already been changed from a constant lambda declaration to an exported function
old
new
Can anyone make sense of what the ngc compiler is complaining about?
angularjs - 使用 Angular 2 AOT 加载 socket.io
我在 angular2 中使用 socket.io 创建了一个项目来发出/监听套接字通信。在 JIT(或 npm start)中一切正常,但是当我尝试通过汇总编译代码以将其作为 AOT 用于生产使用时它不起作用。
节点版本:6.9.4 npm 版本:3.10.6
打字.json
systemjs.config.js
package.json:“socket.io-client”:“^1.7.2”
我的组件.ts
"node_modules/.bin/ngc" -p tsconfig-aot.json 成功执行,但 "node_modules/.bin/rollup" -c rollup-config.js 给出错误:cannot call a namespace ('io')
如果我更改我的组件导入行并设置import io from socket.io-client
然后我得到错误module 'socket.io-client' has no default export
如果有人能指导我完成,我将不胜感激,因为这是我在其他论坛进行故障排除和尝试的第二天。
提前致谢, 卡皮尔