Skip to content

Commit

Permalink
fix: set prod mode for angular, better location handling
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasbaldi committed Jul 12, 2018
1 parent 6d6ff7d commit bba5215
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ jobs:
key: v1-dependencies-{{ checksum "server/package.json" }}
key: v1-dependencies-{{ checksum "client/package.json" }}

# build server (just apidoc)
# build server (just apidoc) & reinstall modules (just production)
- run: cd server; npm run apidoc:public
- run: cd server; rm -rf node_modules
- run: cd server; npm install --production
# build client (angular build)
- run: cd client; npm run build
- run: cd client; npm run lint
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/shared/stjorna.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class StjornaService {
if (window.location.hostname === 'localhost') {
this.host = 'http://localhost:3000';
} else {
this.host = '/';
this.host = window.location.origin;
}
}

Expand Down
8 changes: 2 additions & 6 deletions client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';

// depending on the env mode, enable prod mode or add debugging modules
const config = {
prod: false
};

if (config.prod) {
// if not on localhost url, activate prod mode
if (window.location.hostname !== 'localhost') {
enableProdMode();
}

Expand Down

0 comments on commit bba5215

Please sign in to comment.