Skip to content

Instantly share code, notes, and snippets.

@snewell92
Created June 28, 2017 14:39
Show Gist options
  • Save snewell92/29fb5a94379f1fd6ea33c0f077437148 to your computer and use it in GitHub Desktop.
Save snewell92/29fb5a94379f1fd6ea33c0f077437148 to your computer and use it in GitHub Desktop.
AOT genDir repro
{
"name": "angular-aot-error",
"version": "1.0.0",
"description": "Test to repro genDir issue",
"main": "index.js",
"scripts": {
"build-jit": "tsc -p public/src",
"build-aot": "ngc -p public/src/tsconfig.aot.json"
},
"repository": {
"type": "git",
"url": "none"
},
"author": "",
"license": "ISC",
"dependencies": {
"@angular/animations": "4.2.4",
"@angular/common": "4.2.4",
"@angular/compiler": "4.2.4",
"@angular/compiler-cli": "4.2.4",
"@angular/core": "4.2.4",
"@angular/forms": "4.2.4",
"@angular/http": "4.2.4",
"@angular/platform-browser": "4.2.4",
"@angular/platform-browser-dynamic": "4.2.4",
"@angular/platform-server": "4.2.4",
"@types/node": "8.0.4",
"rxjs": "5.4.1",
"typescript": "2.4.1",
"zone.js": "0.8.12"
}
}
import { Component, ElementRef, Type } from '@angular/core';
@Component({
selector: 'main-content',
template: `<h1>Just a dummy component<h1>`
})
export class AppComponent {
name = 'Angular';
page: string;
constructor(elm: ElementRef) {
this.page = elm.nativeElement.attributes["page"].value;
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
// TODO test enableProdMode after I get a few components on different routes set up
//import { enableProdMode } from '@angular/core';
//enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
{
"compilerOptions": {
"target": "es5",
"outDir": "../aot",
"baseUrl": "src",
"paths": {
"./": ["../src/"]
},
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../../node_modules/@types"
],
"skipLibCheck": true
},
"files": [ "./main-aot.ts", "./app/app.module.ts" ],
"angularCompilerOptions": {
"genDir": "../aot",
"skipMetadataEmit": true
}
}
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "../dist",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"lib": [
"es2016",
"dom"
],
"skipLibCheck": true
},
"files": [ "main-jit.ts", "app/app.module.ts" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment