Skip to content

Commit

Permalink
fix(spa): environment not loaded in app module
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmasberg committed Feb 19, 2024
1 parent b4c5096 commit 30d3d70
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions apps/spa/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { DynamicConfig } from './environments/dynamic-config.model';
import { environment } from './environments/environment';

Expand All @@ -11,9 +10,9 @@ fetch('./assets/config.json')
...(config as DynamicConfig),
...environment,
});

platformBrowserDynamic()
.bootstrapModule(AppModule)
// eslint-disable-next-line no-console
.catch((err) => console.error(err));
});
})
// we have to dynamically import the module, so the environment does not get evaluated before the fetch
.then(() => import('./app/app.module'))
.then(({ AppModule }) => platformBrowserDynamic().bootstrapModule(AppModule))
// eslint-disable-next-line no-console
.catch((err) => console.error(err));

0 comments on commit 30d3d70

Please sign in to comment.