user2650480 user2650480 - 1 year ago 259
AngularJS Question

AngularJS 2 error: enableProdMode is not defined

I'm use https://angular.io/guide/quickstart to start learn Angular2, but I notice there's console log "Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode." So I added to main.ts as following.

import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
enableProdMode();
bootstrap(AppComponent);


Now the browser has error


enableProdMode is not defined(…)


So I found this article https://github.com/angular/angular/issues/6096.

Looks like I'm doing it right, and works on others, so maybe my package files or npm modules has something is wrong? please help, or do you know which module is using enableProdMode?

Answer Source

Seems like you missed to import enableProdMode

import {enableProdMode} from '@angular/core';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download