How to enable production mode?

后端 未结 14 1215
忘掉有多难
忘掉有多难 2020-11-29 16:44

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

14条回答
  •  日久生厌
    2020-11-29 17:36

    My Angular 2 project doesn't have the "main.ts" file mentioned other answers, but it does have a "boot.ts" file, which seems to be about the same thing. (The difference is probably due to different versions of Angular.)

    Adding these two lines after the last import directive in "boot.ts" worked for me:

    import { enableProdMode } from "@angular/core";
    enableProdMode();
    

提交回复
热议问题