Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Build Process to hash the File Name of Asset and Resource Folders

Tags:

I have an Angular 4.4.6 application and I build this using Angular CLI 1.0.1.

The problem I have is, apart from inline.bundle.js, main.bundle, polyfills.bundle.js, styles.bundle.js, vendor.bundle.js files names, all other File Names in "assets" and "resources" folder are NOT hashed when I build the application.

Since the file name is not hashed the request URLs for these files remain same and hence the browsers takes these files from cache it self and new changes are not reflecting.

Can somebody help how I can hash all the file names of "assets" and "resources" folders as well to avoid caching of these files ?

Build Command: ng build --prod --aot --no-sourcemap --output-hash=all 

OS: Windows 10

Thanks

like image 903
D Deshmane Avatar asked May 18 '18 12:05

D Deshmane


1 Answers

Simply set outputHashing to "all" in the angular.json file

"projects": {    ...       },       "architect": {         "build": {           "builder": "@angular-devkit/build-angular:browser",           "options": {            ...           },           "configurations": {             "production": {              ...               "outputHashing": "all", ... 
like image 158
Dariusz Basiak Avatar answered Sep 16 '22 21:09

Dariusz Basiak