-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Versions
<!--
Angular CLI: 6.0.0-beta.5
Node: 9.7.1
OS: darwin x64
Angular: 6.0.0-beta.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 6.0.0-beta.4
@angular/cli: 6.0.0-beta.5
@angular/flex-layout: 5.0.0-beta.13
@angular/material: 6.0.0-beta.4
@angular-devkit/build-optimizer: 0.4.5
@angular-devkit/core: 0.4.5
@angular-devkit/schematics: 0.4.5
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 6.0.0-beta.5
@schematics/angular: 0.4.5
@schematics/package-update: 0.4.5
typescript: 2.6.2
webpack: 4.0.1
Repro steps
- Change
tsconfig.jsontoes2015 - Use angular-cli production mode (
ng serve ---target=production --environment=prod) - Use @angular/common/http
- Make HTTP request
Observed behavior
TypeError: Assignment to constant variable.
In this line:
o = ("responseURL"in (n = n) && n.responseURL ? n.responseURL : /^X-Request-URL:/m.test(n.getAllResponseHeaders()) ? n.getResponseHeader("X-Request-URL") : null) || t.url;
The problem is (n = n). Because n is defined as const n = this.xhrFactory.build();
Here are the corresponding lines in the angular source code:
o = ... = url = ...: https://github.com/angular/angular/blob/c8a1a14b87e5907458e8e87021e47f9796cb3257/packages/common/http/src/xhr.ts#L147
n = n: https://github.com/angular/angular/blob/c8a1a14b87e5907458e8e87021e47f9796cb3257/packages/common/http/src/xhr.ts#L25
Desired behavior
No error ;-)
Mention any other details that might be useful (optional)
It looks like the error comes from function inlining.
But I'm not sure if this problem is part of angular itself, or the TypeScript Compiler, or Uglify, or angular-cli because of bad default production settings.
Metadata
Metadata
Assignees
Labels
No labels