mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-28 12:35:40 +01:00
enable prod mode for angular
This commit is contained in:
parent
4d0e46d893
commit
efbfd9184e
@ -1,6 +1,8 @@
|
|||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
import { isDev } from '../scripts/utils';
|
||||||
|
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
require('../scss/styles.scss');
|
require('../scss/styles.scss');
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
@ -8,4 +10,8 @@ require('../scripts/duo.js');
|
|||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
|
if (!isDev()) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
7
src/scripts/utils.ts
Normal file
7
src/scripts/utils.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export function isDev() {
|
||||||
|
// ref: https://github.com/sindresorhus/electron-is-dev
|
||||||
|
if ('ELECTRON_IS_DEV' in process.env) {
|
||||||
|
return parseInt(process.env.ELECTRON_IS_DEV, 10) === 1;
|
||||||
|
}
|
||||||
|
return (process.defaultApp || /node_modules[\\/]electron[\\/]/.test(process.execPath));
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
import { remote, shell } from 'electron';
|
import { remote, shell } from 'electron';
|
||||||
|
|
||||||
|
import { isDev } from '../scripts/utils';
|
||||||
|
|
||||||
import { DeviceType } from 'jslib/enums';
|
import { DeviceType } from 'jslib/enums';
|
||||||
|
|
||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
@ -143,4 +145,8 @@ export class DesktopPlatformUtilsService implements PlatformUtilsService {
|
|||||||
|
|
||||||
return Promise.resolve(result === 0);
|
return Promise.resolve(result === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDev(): boolean {
|
||||||
|
return isDev();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user