How to enable production mode?

后端 未结 14 1152
忘掉有多难
忘掉有多难 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:45

    To enable production mode in angular 6.X.X Just go to environment file

    Like this path

    Your path: project>\src\environments\environment.ts

    Change production: false from :

    export const environment = {
      production: false
    };
    

    To

    export const environment = {
      production: true
    };
    

    0 讨论(0)
  • 2020-11-29 17:45

    For those doing the upgrade path without also switching to TypeScript use:

    ng.core.enableProdMode()
    

    For me (in javascript) this looks like:

    var upgradeAdapter = new ng.upgrade.UpgradeAdapter();
    ng.core.enableProdMode()
    upgradeAdapter.bootstrap(document.body, ['fooApp']);
    
    0 讨论(0)
提交回复
热议问题