Skip to content

Commit

Permalink
Fix polifills loading in production build (close #33)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Apr 3, 2019
1 parent 60f17f4 commit f97aa25
Show file tree
Hide file tree
Showing 7 changed files with 3,937 additions and 2,279 deletions.
2 changes: 1 addition & 1 deletion client/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { AccountModule } from './account/account.module';
import { AdminModule } from './admin/admin.module';

export function tokenGetter() {
return localStorage.getItem('access_token');
return localStorage.getItem('access_token'); // was 'id_token'
}

let providers: Provider[] = [{
Expand Down
8 changes: 4 additions & 4 deletions client/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import 'hammerjs';

// depending on the env mode, enable prod mode or add debugging modules
if (process.env.NODE_ENV === 'production') {
enableProdMode();
enableProdMode();
}

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

export function main() {
return platformBrowserDynamic().bootstrapModule(AppModule);
return platformBrowserDynamic().bootstrapModule(AppModule);
}

if (document.readyState === 'complete') {
main();
main();
} else {
document.addEventListener('DOMContentLoaded', main);
document.addEventListener('DOMContentLoaded', main);
}
25 changes: 2 additions & 23 deletions client/app/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
// Enable certain polyfills depending on which browsers you need to support
// import 'core-js/es6';
// import 'core-js/es7/reflect';
// import 'core-js/es6/reflect';
// import 'core-js/es7/reflect';
// import 'core-js/features/reflect';
// import 'reflect-metadata';
// import 'core-js';
// import 'zone.js/dist/zone'; // must be last

// Import polyfills.
// import 'babel-polyfill';
// import '@babel/polyfill';
// import 'core-js/features/reflect';
// import 'core-js/proposals/reflect-metadata';
// import 'core-js/stable/reflect';
// import 'core-js/es';
// import 'reflect-metadata';
// https://github.com/angular/angular-cli/issues/13954
// import 'core-js/es';
// import 'core-js/proposals/reflect-metadata';

import 'core-js/es6';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
Expand All @@ -28,11 +7,11 @@ interface IPolyFillErrorConstructor extends ErrorConstructor {
stackTraceLimit: any;
}

if(!ENV) {
if (!ENV) {
var ENV = 'development';
}

if(ENV === 'production') {
if (ENV === 'production') {
// Production
} else {
// Development
Expand Down
Loading

0 comments on commit f97aa25

Please sign in to comment.