I was reading related questions and I found this one, but my question is how can I switch from development to production mode. There are some differences between the modes w
When I built a new project using angular-cli. A file was included called environment.ts. Inside this file is a variable like so.
export const environment = {
production: true
};
Then in main.ts you have this.
import './polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
You could add this to a non angular-cli project, I would assume, because enableProdMode() is being imported from @angular/core.