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 serve (dev mode) doesn't serve updated file from assets directory #9669

Closed
kdcro101 opened this issue Feb 17, 2018 · 8 comments · Fixed by #12543 or #12591
Closed

ng serve (dev mode) doesn't serve updated file from assets directory #9669

kdcro101 opened this issue Feb 17, 2018 · 8 comments · Fixed by #12543 or #12591
Assignees
Labels
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@kdcro101
Copy link

ng serve (dev mode) doesn't serve updated file from assets directory, it serves "version" that was first transmitted (caching problem?).

When file in assets directory is changed via external shell script (child tsconfig to generate javascript for web workers [tsc + browserify + uglify]), ng serve serves version of file that was transmitted on first request.

Server needs to be restarted for changes to pick-up.

Versions

Angular CLI: 1.6.8
Node: 8.9.3
OS: linux x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.2.1
@angular/cli: 1.6.8
@angular/flex-layout: 2.0.0-beta.12
@angular/material: 5.2.1
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack-bundle-analyzer: 2.10.0
webpack: 3.10.0

Repro steps

run ng serve, change some javascript file inside assets directory
assets/workers/some.js for example, using above mentioned tools

Observed behavior

ng serve - serves outdated js file which doesn't exist on storage/drive (caching?)

Desired behavior

To serve updated file from storage.

@kdcro101
Copy link
Author

Also, when files are copied into project (imported type defs) it doesn't trigger change mechanism.
If I am having error which is reported via console output of ng serve after copying into project , corrected .ts files, using linux cp command it doesn't trigger ng serve rebuild processs, so ng serve must be restarted

@clydin
Copy link
Member

clydin commented Feb 20, 2018

This appears to be a bug but we will need to look at a reproduction to find and fix the problem. Can you setup a minimal reproduction please?

You can read here why this is needed. A good way to make a minimal reproduction is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

@clydin clydin added type: bug/fix needs: repro steps We cannot reproduce the issue with the information given labels Feb 20, 2018
@MickL
Copy link

MickL commented Jun 14, 2018

I can reproduce this on latest version @angular/cli ~6.0.8: A changed file is recognized while new or moved files are not copied to dist.

To reproduce run ng build --watch. After compilation is done place new file into src/assets, or move an existing file -> nothing happens.

@virgil-av
Copy link

I have been trying to find a solution for this and nothing for me it is:

  • generate some css files with grunt copy them into assets folder after the app is already started with ng serve
  • change sass compile with grunt have new files in assets app will recompile
  • change again and compile with grunt app will not recompile and add new assets to in memory assets
  • kill the server and start ng serve will produce the same result over and over again

@DenysVuika
Copy link

Having exactly same problem with 6.2. After "automatic" reload I have to reload the app manually one more time to get the actual copy of the code.

@alan-agius4 alan-agius4 removed the needs: repro steps We cannot reproduce the issue with the information given label Sep 21, 2018
@ngbot ngbot bot added this to the needsTriage milestone Sep 21, 2018
@filipesilva filipesilva added freq1: low Only reported by a handful of users who observe it rarely severity5: regression labels Sep 24, 2018
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Sep 24, 2018
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Sep 28, 2018

We have looked into this and it is related to one of our dependencies.

I have created a PR at upstream to solve this issue.
webpack-contrib/copy-webpack-plugin#290

@filipesilva
Copy link
Contributor

#12591 should fix this by updating the dependency.

kyliau pushed a commit that referenced this issue Oct 23, 2018
…ndency

This fixes the issue that newly added files are not copied on serve

Fixes #9669
kyliau pushed a commit that referenced this issue Oct 23, 2018
…ndency

This fixes the issue that newly added files are not copied on serve

Fixes #9669
@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 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
8 participants