aot

Angular AOT compilation error \"cannot determine module for class Component''

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an Angular (4.3.2) application on which I want to perform an AOT build. App was created using @angular/cli . I have two components scaffolded with ng generate and a module in which both are included as a declaration: import {PrivateComponent} from './private.component/private.component'; NgModule({ imports: [ // other imports PrivateRoutingModule ], declarations: [ ...some other components, PrivateComponent, AppTopBarComponent ] // other stuff }) export class PrivateModule {} Private component is also used in the module's routing:

Angular AOT compilation error \"cannot determine module for class Component''

只愿长相守 提交于 2019-12-03 06:00:43
I have an Angular (4.3.2) application on which I want to perform an AOT build. App was created using @angular/cli . I have two components scaffolded with ng generate and a module in which both are included as a declaration: import {PrivateComponent} from './private.component/private.component'; NgModule({ imports: [ // other imports PrivateRoutingModule ], declarations: [ ...some other components, PrivateComponent, AppTopBarComponent ] // other stuff }) export class PrivateModule {} Private component is also used in the module's routing: const routes: Routes = [ {path: '', component:

Angular 2 Aot Error: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: While Running Angular 2 AOT rollup I have faced above issue <--- Last few GCs ---> 144518 ms: Mark-sweep 1317.0 (1404.4) -> 1317.0 (1404.4) MB, 1522.9 / 0.0 ms [allocation failure] [GC in old space requested]. 146029 ms: Mark-sweep 1317.0 (1404.4) -> 1317.0 (1404.4) MB, 1511.6 / 0.0 ms [allocation failure] [GC in old space requested]. 147566 ms: Mark-sweep 1317.0 (1404.4) -> 1321.2 (1403.4) MB, 1536.2 / 0.0 ms [last resort gc]. 149101 ms: Mark-sweep 1321.2 (1403.4) -> 1325.4 (1403.4) MB, 1535.4 / 0.0 ms [last resort gc]. <--- JS stacktrace -

Angular2 AOT with Lazy loading Can't resolve [path to lazy module].ngfactory.ts

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to convert an App that was already working with Lazy loaded modules into AOT. I am using the @ngtools/webpack toolkit to compile the AOT code, however I am getting into an error that Angular cant find the Lazy loaded module's code as it seems. ERROR in ./ src / ngfactory async Module not found : Error : Can 't resolve ' / Library / WebServer / Documents / envato - teams / src / ngfactory / src / app / components / container / projects . ngfactory . ts ' in ' / Library / WebServer / Documents / envato - teams / src /

Angular 2 AOT build error - JavaScript heap out of memory

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My Angular 2 app is generated by angular2-webpack-starter . When I run command npm run build:aot to build AOT package, the console shows the following error message: ..... 92% chunk asset optimization 500690 ms: Mark-sweep 1290.1 (1421.8) -> 1290.1 (1437.8) MB, 1219.8 / 0.0 ms [allocation failure] [GC in old space requested]. 501898 ms: Mark-sweep 1290.1 (1437.8) -> 1290.1 (1437.8) MB, 1207.9 / 0.0 ms [allocation failure] [GC in old space requested]. 503171 ms: Mark-sweep 1290.1 (1437.8) -> 1298.4 (1421.8) MB, 1272.9 / 0.0 ms [last resort gc

AOT NgModule provider with dependencies, NullInjectorError

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've tried the implementation in https://stackoverflow.com/a/43293449/513570 : @NgModule() export class SampleModule { static forRoot(config: CustomConfig): ModuleWithProviders { // User config get logged here console.log(config); return { ngModule: SampleModule, providers: [SampleService, {provide: 'config', useValue: config}] }; } } @Injectable() export class SampleService { constructor(@Inject('config') private config:CustomConfig) { const sConfig = { key: 'value' }; @NgModule({ declarations: [ ... ], imports: [ BrowserModule, HttpModule,

window is not defined using Angular4 + AoT + Webpack2

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have an angular4 app that uses webpack and has been working great with JiT but now I'm trying to get it working with AoT and I'm having issues. Specifically I'm getting the following error: ERROR in window is not defined ERROR in ./ src / app / main / main . ts Module not found : Error : Can 't resolve ' ./../../../ aot - main / src / app / main / app . module . ngfactory ' in ' W : \< Full Path to App > \src\app\main ' resolve ' ./../../../ aot - main / src / app / main / app . module . ngfactory ' in ' W : \< Full Path to App >

Angular2 AoT - Expression form not supported

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use ngc to compile angular 2.4.4: Error: Error encountered resolving symbol values statically. Expression form not supported (position 52:9 in the original .ts file), resolving symbol DEFAULT_APP_STATE in... 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: export const DEFAULT_APP_STATE = { Offline: DEFAULT_APP_OFFLINE_STATE, Initialized: DEFAULT_APP_INITIALIZED_STATE, Console: DEFAULT

Angular AOT &amp; Rollup - Uncaught ReferenceError: exports is not defined

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to implement Angular's AOT tutorial: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html Using ngc part works and it generates aot folder. However,when I run the application, I get the below error bundle.js:1 Uncaught ReferenceError: exports is not defined My code is as below :- tsconfig-aot.json { "compilerOptions": { "target": "es5", "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": ["es2015", "dom"], "noImplicitAny": true,

angular2的编译模式之AOT和JIT

匿名 (未验证) 提交于 2019-12-03 00:38:01
原文   https://www.jianshu.com/p/c959d90e91ce 大纲   1、angular应用为什么需要编译   2、angular的编译模式类型   3、JIT(Just-In-Time)   4、AOT(Ahead-Of-Time)   5、JIT vs AOT   6、Angular2引导方式:基于JIT的动态引导和基于AOT的静态引导。 1、angular应用为什么需要编译   Angular应用中包含的组件、HTML模板(比如:@Directive、@Component、@NgModule、@Pipe)很多都是JS VM无法解析的,所以在浏览器渲染应用之前,组件和模板必须要被Angular编译器转换为可以执行的JavaScript。 2、angular的编译模式类型   在 Angular 2 中有两种编译模式:     JIT - Just-In-Time - 即时编译     AOT - Ahead-Of-Time - 预先编译 3、JIT(Just-In-Time)   1、使用 TypeScript 开发 Angular 应用   2、运行 tsc 编译 TypeScript 代码   3、使用 Webpack 或 Gulp 等其他工具构建项目,如代码压缩、合并等   4、部署应用   1、下载应用相关的资源,如 JavaScript