question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MickLcommented, 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.

1reaction
filipesilvacommented, Oct 16, 2018

https://github.com/angular/angular-cli/pull/12591 should fix this by updating the dependency.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to serve static directory from "ng serve" - Stack Overflow
Look in the root of your Angular app for a file called angular.json . There's an entry called "assets". Add your static directories...
Read more >
Angular PWA, install and configure - DEV Community ‍ ‍
Run ng build --prod command. It will create files under dist/angular-pwa folder. · Navigate to that folder using cd dist/angular-pwa · Run http- ......
Read more >
Watch and WatchOptions | webpack
Webpack can watch files and recompile whenever they change. ... In webpack-dev-server and webpack-dev-middleware watch mode is enabled by default.
Read more >
Service worker configuration - Angular
The ngsw-config.json configuration file specifies which files and data URLs the Angular service worker should cache and how it should update the cached ......
Read more >
A complete guide to Angular libraries - Will Taylor Blog
ng new example-component-library --create-application=false cd ... component and service files - we do not need these.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found