Angular 5 build 避免浏览器缓存

版权声明:本文为博主原创文章,转载需注明出处。 https://blog.csdn.net/jiangshanwe/article/details/82056315

ng build –prod

使用ng build --prod即可完成生产环境构建。观察dist文件夹,发现所有js文件名中间都会加上文件的hash值,从而避免浏览器缓存导致发布无效。

ng build –output-hashing=all

由于各种原因(prod检查非常严格),ng build --prod命令可能无法成功。
使用--output-hashing=all参数即可。

output-hashing
–output-hashing
Define the output filename cache-busting hashing mode.

参考

https://github.com/angular/angular-cli/wiki/build

猜你喜欢

转载自blog.csdn.net/jiangshanwe/article/details/82056315
今日推荐