Skip to content

Commit

Permalink
fix(angular): production builds using aot compiler (#12381)
Browse files Browse the repository at this point in the history
Fixes TIMOB-28205
  • Loading branch information
build authored Jan 12, 2021
1 parent 159be91 commit 30038d7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 9 deletions.
4 changes: 2 additions & 2 deletions templates/app/angular-default/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"@angular-eslint/template-parser": "0.5.0-beta.4",
"@angular/compiler-cli": "~9.1.0",
"@ngtools/webpack": "~9.1.0",
"@titanium-sdk/webpack-plugin-angular": "^0.1.2",
"@types/titanium": "~9.1.0",
"@titanium-sdk/webpack-plugin-angular": "^0.2.0",
"@types/titanium": "~9.2.0",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"eslint": "^7.11.0",
Expand Down
4 changes: 3 additions & 1 deletion templates/app/angular-default/template/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ import { IntroComponent } from './intro.component';
schemas: [NO_ERRORS_SCHEMA]
})
export class AppModule {

constructor() {
Ti.UI.backgroundColor = Ti.UI.fetchSemanticColor('primaryBg');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"primaryBg": {
"dark": "#272727",
"light": "#ffffff"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file will be replaced during production builds by environment.prod.ts

export const environment = {
production: false
};

/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
4 changes: 0 additions & 4 deletions templates/app/angular-default/template/src/main.aot.ts

This file was deleted.

11 changes: 9 additions & 2 deletions templates/app/angular-default/template/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import './polyfills';
import { enableProdMode } from '@angular/core';
import { platformTitaniumDynamic } from 'titanium-angular';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformTitaniumDynamic()
.bootstrapModule(AppModule);
platformTitaniumDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

0 comments on commit 30038d7

Please sign in to comment.