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 --watch and ng serve don't always build updated files after new changes #4566

Closed
JavierPDev opened this issue Feb 9, 2017 · 7 comments

Comments

@JavierPDev
Copy link

JavierPDev commented Feb 9, 2017

I usually need to save changes multiple times in order for angular-cli to actually build files with those changes.

OS?

Ubuntu 16.10 x64

Versions.

angular-cli: 1.0.0-beta.28.3
node: 7.1.0
os: linux x64

Repro steps.

This happens for any angular-cli app I make, even fresh ones.

In the log below you can see the initial build when running ng build --watch with Hash: 91bb893998276a59bbb3. Then I make a change to app.component.ts and save it. Angular-cli responds with those next builds with the same Hash: 91bb893998276a59bbb3 which results in dist files without the new change. I go back to app.component.ts and save again. Finally angular-cli responds with new Hash: 99e3be9aeef7c621e6f3 and the dist files include the new change.

The log given by the failure.

Hash: 91bb893998276a59bbb3
Time: 7868ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.94 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
Hash: 91bb893998276a59bbb3
Time: 625ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.94 kB {3} [initial]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
Hash: 91bb893998276a59bbb3
Time: 594ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.94 kB {3} [initial]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
Hash: 91bb893998276a59bbb3
Time: 568ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.94 kB {3} [initial]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
Hash: 99e3be9aeef7c621e6f3
Time: 526ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.97 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
Hash: 99e3be9aeef7c621e6f3
Time: 576ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.97 kB {3} [initial]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]

Mention any other details that might be useful.

I thought this problem might be due to the Inotify Watches Limit on Linux that has been mentioned in some issues but setting it to 524288 does not fix the problem and it seems to me that angular-cli knows when the changes happen but doesn't include them in the build for some reason. Also none of the directories have spaces or special characters in their name and webpack runs fine in other projects.

@efstathiosntonas
Copy link

efstathiosntonas commented Feb 9, 2017

This is a known issue, going back to "@ngtools/webpack" : "1.2.4" fixes the issue but you will lose the new perfomance improvements in building time of version 1.2.6 and up.

@JavierPDev
Copy link
Author

Thanks a bunch, efstathiosntonas. Just ran npm install @ngtools/[email protected] and now things are working as they should. Apologies for bringing up a known issue, I didn't see it when looking through the issues for anything similar to my problem, I only came across the Windows/special character directories and Inotify watches limit issues.

@hccampos
Copy link

Having the same issue here actually, on Ubuntu. Will try to dig into it some more. So far I figured out that it is always the same files that it refuses to rebuild, so I think it is something related to the current dependency graph.

@instantepiphany
Copy link

Installing 1.2.4 of webpack doesn't fix it for me, is there any workaround to use in the meantime? Killing and then running ng serve after each file save is annoying and takes so long compared to recompiling when already running.

@filipesilva
Copy link
Contributor

Heya, let's talk about this in #5117 since it's still open and has a fair amount of replies there. I can't get a repro of this issue and would appreciate if someone has one.

@halben
Copy link

halben commented Sep 17, 2017

Have you tried removing --aot option? That works for me.

@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
None yet
Projects
None yet
Development

No branches or pull requests

6 participants