Skip to content

enableProdMode() does not disable ngDevMode in ssr #36692

@sod

Description

@sod

🐞 bug report

import {enableProdMode} from '@angular/core';

enableProdMode();

^ this does not really disable dev mode in ssr. The mere act of doing require '@angular/core' in node.js initializes ngDevMode inside the umd bundle of @angular/core.

What we do right now is including this as the very first line of our server:

(global as any).ngDevMode = false;

This improves ssr throughput by ~44% in our case (from ~18 renders per second to ~26 renders per second). And of course reduces the response size significantly as all those ng-reflect attributes and comments disappear.

Affected Package

@angular/core version 9.1.2

Is this a regression?

I'm pretty sure enableProdMode() actually disabled the devMode before ivy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions