ng serve (dev mode) doesn't serve updated file from assets directory
See original GitHub issueng 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:
- Created 6 years ago
- Reactions:5
- Comments:8 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 intosrc/assets
, or move an existing file -> nothing happens.https://github.com/angular/angular-cli/pull/12591 should fix this by updating the dependency.