From 9cafb76781b953e39ff1bdd331c03b5930bd1567 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 5 Jun 2018 00:31:06 -0400 Subject: [PATCH] enable prod mode on production env --- src/app/main.ts | 4 +++- src/global.d.ts | 1 + webpack.config.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/main.ts b/src/app/main.ts index e75492b296..3dc3e00a05 100644 --- a/src/app/main.ts +++ b/src/app/main.ts @@ -6,6 +6,8 @@ require('../scss/styles.scss'); import { AppModule } from './app.module'; -// enableProdMode(); // TODO: if production +if (process.env.ENV === 'production') { + enableProdMode(); +} platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/src/global.d.ts b/src/global.d.ts index 5aac7e6d40..db0c0d97ac 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,3 +1,4 @@ declare function escape(s: string): string; declare function unescape(s: string): string; declare var require: any; +declare var process: any; diff --git a/webpack.config.js b/webpack.config.js index 667aceb38c..259076c8cd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,7 +7,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; -if (process.env.NODE_ENV == null || process.env.WEBPACK_SERVE) { +if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'development'; } const ENV = process.env.ENV = process.env.NODE_ENV;