angular-compiler-cli

Angular Compiler throws Internal error: unknown identifier {}

浪子不回头ぞ 提交于 2021-01-27 18:52:31
问题 I am constructing my angular2 services like so import { OpaqueToken, ClassProvider } from "@angular/core"; export interface IService { // ... interface declaration } export class Service implements IService { // ... implementation goes here } export const IService = new OpaqueToken(Service.name); export const ServiceProvider: ClassProvider = { provide: IService, useClass: Service, }; This has worked and compiled wonderfully using ngc with angular 2.x.x But after upgrading to angular 4.x.x,

AOT compiler - include lazy loaded external module

两盒软妹~` 提交于 2020-01-12 05:43:05
问题 I am trying to include external module (hosted in git/npm repository) as lazy-loaded module in my Angular application. I am compiling my external module with ngc compiler: node_modules/.bin/ngc -p tsconfig-aot.json This is how my compiler config looks: { "extends": "./tsconfig.json", "compilerOptions": { "baseUrl": "src", "declaration": true, "outDir": "./release/src" }, "files": [ "./src/index.ts" ], "angularCompilerOptions": { "genDir": "release", "skipTemplateCodegen": true, "entryModule":

how to use ahead-of-time compiler with angular cli webpack

[亡魂溺海] 提交于 2020-01-10 07:59:10
问题 is there a way to use AOT with angular cli? I've installed the modules (@angular/compiler @angular/compiler-cli) and when I type ngc -p scr it creates the ngFactory.ts files and compiles it to dist/tsc-out (angular cli default in tsconfig) not sure how to proceed from here :) Cheers Han 回答1: All recent beta versions of the Angular CLI support AoT via the following: ng serve --aot ng build --aot #and of course ng build --prod --aot Note: As of Angular CLI 1.0.0-beta.28 (released February 1st,

how to use ahead-of-time compiler with angular cli webpack

瘦欲@ 提交于 2020-01-10 07:58:08
问题 is there a way to use AOT with angular cli? I've installed the modules (@angular/compiler @angular/compiler-cli) and when I type ngc -p scr it creates the ngFactory.ts files and compiles it to dist/tsc-out (angular cli default in tsconfig) not sure how to proceed from here :) Cheers Han 回答1: All recent beta versions of the Angular CLI support AoT via the following: ng serve --aot ng build --aot #and of course ng build --prod --aot Note: As of Angular CLI 1.0.0-beta.28 (released February 1st,

Angular AOT failing at compilation (something with angular/compiler-cli)

蓝咒 提交于 2019-12-22 14:41:48
问题 After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and am getting the following error "node_modules/.bin/ngc" -p tsconfig-aot.json TypeError: compiler.AnimationParser is not a constructor at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400) at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36) at Object.main (C:\Projects\NeilKellyClient4\node

Angular AOT failing at compilation (something with angular/compiler-cli)

╄→尐↘猪︶ㄣ 提交于 2019-12-22 14:40:25
问题 After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and am getting the following error "node_modules/.bin/ngc" -p tsconfig-aot.json TypeError: compiler.AnimationParser is not a constructor at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400) at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36) at Object.main (C:\Projects\NeilKellyClient4\node

how to use ahead-of-time compiler with angular cli webpack

北战南征 提交于 2019-11-30 03:51:15
is there a way to use AOT with angular cli? I've installed the modules (@angular/compiler @angular/compiler-cli) and when I type ngc -p scr it creates the ngFactory.ts files and compiles it to dist/tsc-out (angular cli default in tsconfig) not sure how to proceed from here :) Cheers Han Brocco All recent beta versions of the Angular CLI support AoT via the following: ng serve --aot ng build --aot #and of course ng build --prod --aot Note: As of Angular CLI 1.0.0-beta.28 (released February 1st, 2017), --aot is on by default if --prod is specified. Angular-cli beta 17 now supports --aot :) ! See

window is undefined when used as useValue provider with Angular 4 AoT

假如想象 提交于 2019-11-28 12:30:33
When Angular 4.0.2 application is compiled ahead-of-time, and the provider is defined as useValue import { OpaqueToken, Provider } from '@angular/core'; export const windowToken = new OpaqueToken('window'); export const windowProvider = { provide: windowToken, useValue: window }; and used like @NgModule({ providers: [windowProvider], ... }) export class AppModule {} it compiles ok but results in window being undefined when injected as constructor(@Inject(windowToken) window) { window.navigator... } The error is thrown on bootstrapping: TypeError: Cannot read property 'navigator' of undefined

What does the angular compiler “compile”?

北慕城南 提交于 2019-11-28 03:17:54
I was asked that today and was not able to give a proper answer. Typescript transpiles to JS. Then there is tree shaking, "less" (optional) and what else in the process of making a deployment. But nothing like that (afaik) has anything to do with "compiling". Everything gets bundled and heavily optimized, but it's not actually compiled, right? There is even an ahead of time compiler, which really does a noticeable job. What do I miss? Javascript itself is still intepreted, right? You're presuming compiling means taking the source code and producing machine code, low-level codes, etc. But

How to retrieve a component's metadata in Angular

一笑奈何 提交于 2019-11-27 21:51:31
问题 An Angular component has decorators: @Component({ ... }) export class MyAngularComponent { @Input() myInputParam: MyType; @Input() myOtherInputParam: MyOtherType; @Output() myOutputParam: MyOtherOutputType; } I've got an Angular library where a lot of code repetitions could be avoided (and bundle size reduced) if I could programmatically retrieve Angular's @Input() decorators inside a given component class (that belongs to the library, though) . But I have doubts on the portability of such an