Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng build --prod --watch compiles app state before the save #5137

Closed
bklik opened this issue Mar 1, 2017 · 12 comments · Fixed by #7480
Closed

ng build --prod --watch compiles app state before the save #5137

bklik opened this issue Mar 1, 2017 · 12 comments · Fixed by #7480
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity2: inconvenient type: bug/fix

Comments

@bklik
Copy link

bklik commented Mar 1, 2017

Description:

While running a build watch with the '--prod' or '--aot' options, the results to dist seem to be one save behind. Meaning, if I make a change and save, the change is detected and the project builds, however the results are the state of the app before the change. If I make another change, like adding a new line to a file, the change is detected and the project built, with the results of the previous save but not capturing the new lines added.

Note: This issue goes away if the '--prod' or '--aot' options are not used.

OS?

Windows 10

Versions.

@angular/cli: 1.0.0-beta.30
node: 6.9.5
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.30
@angular/compiler-cli: 2.4.8

Repro steps.

ng new test-app
ng build --prod --watch
or
ng build --aot --watch
or
ng build --prod --aot --watch

The log given by the failure.

None

@bklik
Copy link
Author

bklik commented Mar 2, 2017

After solving issue #5138 this problem went away. My guess is I somehow had multiple versions of angular-cli installed that were conflicting with each other.

@bklik
Copy link
Author

bklik commented Mar 2, 2017

Correction, I'm still experiencing this issue on another computer after following the same steps I used to solve #5138 . I found that if I make a change to the index file, I can see the change take immediate effect in the dist folder. However, a change to a component does not show up, and is always one save behind.

@lbialy
Copy link

lbialy commented Mar 4, 2017

Same here, build -w --aot outputs first compilation result correctly, but then every next rebuild is one save behind (I have to make 2 changes & saves to see result of first change). Doesn't happen without --aot / --prod.

@filipesilva
Copy link
Contributor

Can confirm this also happens on ng serve --aot. Looking into it.

@filipesilva
Copy link
Contributor

Possibly related, but I can't see the issue fixed by it: #4009

@filipesilva
Copy link
Contributor

I investigated a bit more and this doesn't seem to happen on all changes.

I can reproduce when changing a component template, but not when changing the component itself (changes are immediately reflected in this case).

So this seems related to the child compilers we use.

@ddehghan
Copy link

FYI - I might have had this same issue. Apparently I had another ng build process running in the background. when I killed that the issue got resolved.

@jd-carroll
Copy link

@filipesilva @bklik I am also experiencing this issue...
(My current workflow is to always CTRL+S twice)

I noticed on @bklik's version output that they are running node: 6.9.5. My local version of node is 6.9.5 and wondering if that could have anything to do with this?

Unfortunately, I can only installed "approved" versions of node at work 👎 so I cannot update my node at this time.

@kianfang
Copy link

OS: Ubuntu 16.04.
Command: "ng build --watch -prod -oh none --aot true".
My save .css .html file is to always CTRL+S twice. (loading build is so long)

@christianacca
Copy link

I noticed the same / similar problem myself.

What I observed

  1. serve in the browser: npm start -- -o -aot
  2. change a component ts file such that it breaks the compile
    • for me, I changed a component property referenced in the template to private
    • as expected, webpack complains with the message "wepack: Failed to compile"
  3. change the component ts file such that it fixes the compile failure, and press save
    • webpack runs but still complains with the message "wepack: Failed to compile"
  4. without make any further changes, press save again
    • this time webpack builds successfully

You can reproduce this problem in the following repo (generated using the cli): christianacca/rxjs-err-async-pipe@c9909e4

Try changing ticks$ to private

My environment

  • Windows 10 anniversary edition
  • Visual Studio Code 1.11.2
  • node 6.9.2
  • angular 4.1.0
  • angular cli 1.0.1

@filipesilva filipesilva added effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity2: inconvenient labels May 23, 2017
@filipesilva filipesilva removed their assignment May 23, 2017
@ThomasBeavers
Copy link

I am seeing the same problem. Change are always one save behind. The behavior is only experienced when using --aot or --prod. Other developers with the same project get the same problem. I see the same problem with the repo that @christianacca linked above.

My environment

  • Windows 10 Enterprise Creators Update
  • WebStorm or Visual Studio 2015
  • @angular/cli: 1.3.0
  • node: 6.10.3
  • @angular/common: 4.3.3
  • @angular/compiler-cli: 4.3.3

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity2: inconvenient type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants