angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

Production build duplicates compilation error messages #6468

Closed HarelM closed 6 years ago

HarelM commented 7 years ago

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting

Versions.

@angular/cli: 1.0.4 node: 6.10.3 os: win32 x64 @angular/common: 4.1.3 @angular/compiler: 4.1.3 @angular/core: 4.1.3 @angular/forms: 4.1.3 @angular/http: 4.1.3 @angular/platform-browser: 4.1.3 @angular/platform-browser-dynamic: 4.1.3 @angular/router: 4.1.3 @angular/animations: 4.1.3 @angular/material: 2.0.0-beta.5 @angular/flex-layout: 2.0.0-beta.8 @angular/cli: 1.0.4 @angular/compiler-cli: 4.1.3

Repro steps.

Not sure, in my case it allways happens - error are emitted twice:

PS D:\Github\IsraelHikingMap\Angular4\IsraelHiking.Web> ng build --prod
Hash: 8c20bb116c87a2178894
Time: 59336ms
chunk    {0} main.9df56a9a31f40436fb91.bundle.js (main) 2.55 MB {4} [initial] [rendered]
chunk    {1} polyfills.d6a7180f7ae545ce655e.bundle.js (polyfills) 158 kB {5} [initial] [rendered]
chunk    {2} styles.27eaa9df55f5345f6e85.bundle.css (styles) 387 bytes {5} [initial] [rendered]
chunk    {3} scripts.48dd321a1e9e44da83f3.bundle.js (scripts) 1.14 kB {5} [initial] [rendered]
chunk    {4} vendor.c6927397ae5ffb46591f.bundle.js (vendor) 4.64 MB [initial] [rendered]
chunk    {5} inline.b4f16877f09bfc3aa520.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (37,48): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (37,77): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (36,176): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/layers/OverlayEditDialogComponent.ts (33,12): Class 'LayerBaseDialogComponent' defines instance member function 'removeLayer', but extended class 'OverlayEditDialogComponent' defines it as instance member property.

--- duplication start here ---

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (37,48): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (37,77): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/osmUserDialog.html (36,176): Property 'file' does not exist on type 'OsmUserDialogComponent'.

ERROR in D:/Github/IsraelHikingMap/Angular4/IsraelHiking.Web/sources/application/components/dialogs/layers/OverlayEditDialogComponent.ts (33,12): Class 'LayerBaseDialogComponent' defines instance member function 'removeLayer', but extended class 'OverlayEditDialogComponent' defines it as instance member property.

The log given by the failure.

no crash - no stack strace

Desired functionality.

Each error should be written once.

Mention any other details that might be useful.

I'll be surprised if I'm the first to see this, but I couldn't find another issue on this.

HazizKhan commented 7 years ago

i fix this error with ng build --prod --aot=false

HarelM commented 7 years ago

I guess this might work but it is a workaround, and assumes I don't want to AoT my code.

HazizKhan commented 7 years ago

@HarelM Angular cli build your code AoT to default. with --aot=false flag we say to angular cli dont Aot our code.

HarelM commented 7 years ago

I fully understand the flag :) but it should still not emit duplicate errors when this flag is not specified...

sumitarora commented 7 years ago

@HarelM Do you have code somewhere in repo replicating the issue?

HarelM commented 7 years ago

Any typescript compilation error. I have a repository but I think it's too complicated...

HarelM commented 7 years ago

This one should do - getting the following errors when running ng build --prod:

ERROR in ng:///D:/Github/IsraelHikingMap/Issue17039/IsraelHiking.Web/sources/application/components/routeStatistics.html (13,5): Property 'thisMethodDoesNotExistInFile' does not exist on type 'RouteStatisticsComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Issue17039/IsraelHiking.Web/sources/application/components/routeStatistics.html (14,5): Property 'thisOneEither' does not exist on type 'RouteStatisticsComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Issue17039/IsraelHiking.Web/sources/application/components/routeStatistics.html (13,5): Property 'thisMethodDoesNotExistInFile' does not exist on type 'RouteStatisticsComponent'.

ERROR in ng:///D:/Github/IsraelHikingMap/Issue17039/IsraelHiking.Web/sources/application/components/routeStatistics.html (14,5): Property 'thisOneEither' does not exist on type 'RouteStatisticsComponent'.

Issue6468-src.zip

filipesilva commented 7 years ago

I can verify I also get double errors. Using windows, and adding the following code to src/app/app.component.ts:

interface SomeInterface {
  prop: number;
}

const impl: SomeInterface = {prop: 42}
impl.anotherProp = 43;

Results in:

kamik@T460p MINGW64 /d/sandbox/master-project (master)
$ ng build
Hash: 399ec6f4fb67d11884d2
Time: 8894ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 157 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 60.5 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 65.2 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 1.81 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

ERROR in D:/sandbox/master-project/src/app/app.component.ts (17,6): Property 'anotherProp' does not exist on type 'SomeInterface'.

ERROR in D:/sandbox/master-project/src/app/app.component.ts (17,6): Property 'anotherProp' does not exist on type 'SomeInterface'.

Doesn't seem to need to be an AOT error on a template for me.

jtsom commented 7 years ago

Just another data point - I am seeing this issue, but not on Windows - my app is running on Ubuntu linux, and occurs when just doing ng s. Adding the --aot=false flag removed the duplicated.

This happens in one project, but not another, so am unsure the root cause...

HarelM commented 7 years ago

I can also see this in the tests I'm running (ng test) - when a test fails the failure is duplicated.

Chrome 59.0.3071 (Windows 10 0.0.0) RouteStatisticsService Should return 0 distance for statistics not on route FAILED
        Expected 0 not to be 0.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:1813:30)
            at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/polyfills.bundle.js:2799:26)
            at ProxyZoneSpec.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/vendor.bundle.js:38496:39)
            at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/polyfills.bundle.js:2798:32)
Chrome 59.0.3071 (Windows 10 0.0.0) RouteStatisticsService Should return 0 distance for statistics not on route FAILED
        Expected 0 not to be 0.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:1813:30)
            at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/polyfills.bundle.js:2799:26)
            at ProxyZoneSpec.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/vendor.bundle.js:38496:39)
            at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_ka
ArjanKw commented 6 years ago

Running on Windows, errors are shown twice on our Angular 4 project too. Adding --aot=false doesn't solve the issue.

The following command results in errors shown twice: ng build --aot=false

Running ng --version gives the following output:

@angular/cli: 1.3.2 node: 6.10.2 os: win32 x64 [...] @angular/core: 4.4.6

Absolutely not a dealbreaker, but it can be somewhat confusing.

filipesilva commented 6 years ago

I'm closing this as solved in newer versions. 1.6.3 shows only one error for my reproduction in https://github.com/angular/angular-cli/issues/6468#issuecomment-305207691.

@ArjanKw you're using a fairly old version that does not have the fix. If you update it should go away.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.