]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/environment.ts
Fix prod build
[github/Chocobozzz/PeerTube.git] / client / src / app / environment.ts
CommitLineData
8635a2c7
C
1/**
2 * Angular 2
3 */
4import {
5 enableDebugTools,
6 disableDebugTools
7} from '@angular/platform-browser';
8import {
9 ApplicationRef,
10 enableProdMode
11} from '@angular/core';
12/**
13 * Environment Providers
14 */
c16ce1de 15let PROVIDERS: any[] = [
8635a2c7
C
16 /**
17 * Common env directives
18 */
ab32b0fc
C
19];
20
8635a2c7
C
21/**
22 * Angular debug tools in the dev console
23 * https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
24 */
25let _decorateModuleRef = <T>(value: T): T => { return value; };
ab32b0fc
C
26
27if ('production' === ENV) {
ab32b0fc
C
28 enableProdMode();
29
8635a2c7
C
30 /**
31 * Production
32 */
c16ce1de
C
33 _decorateModuleRef = (modRef: any) => {
34 disableDebugTools();
35
36 return modRef;
37 };
38
ab32b0fc
C
39 PROVIDERS = [
40 ...PROVIDERS,
8635a2c7
C
41 /**
42 * Custom providers in production.
43 */
ab32b0fc
C
44 ];
45
46} else {
47
48 _decorateModuleRef = (modRef: any) => {
49 const appRef = modRef.injector.get(ApplicationRef);
50 const cmpRef = appRef.components[0];
51
8635a2c7 52 let _ng = (<any> window).ng;
ab32b0fc 53 enableDebugTools(cmpRef);
8635a2c7
C
54 (<any> window).ng.probe = _ng.probe;
55 (<any> window).ng.coreTokens = _ng.coreTokens;
ab32b0fc
C
56 return modRef;
57 };
58
8635a2c7
C
59 /**
60 * Development
61 */
ab32b0fc
C
62 PROVIDERS = [
63 ...PROVIDERS,
8635a2c7
C
64 /**
65 * Custom providers in development.
66 */
ab32b0fc
C
67 ];
68
69}
70
71export const decorateModuleRef = _decorateModuleRef;
72
73export const ENV_PROVIDERS = [
74 ...PROVIDERS
75];