gpt4 book ai didi

用于散列 Assets 和资源文件夹的文件名的 Angular 构建过程

转载 作者:行者123 更新时间:2023-12-03 07:34:06 25 4
gpt4 key购买 nike

我有一个 Angular 4.4.6 应用程序,我使用 构建它 Angular CLI 1.0.1 .
我的问题是,除了 inline.bundle.js , main.bundle , polyfills.bundle.js , styles.bundle.js , vendor.bundle.js文件名,“ Assets ” 和“ 资源 ” 文件夹中的所有其他文件名 没有散​​列 当我构建应用程序时。
由于文件名没有散列,这些文件的请求 URL 保持不变,因此浏览器从缓存中获取这些文件,并且不会反射(reflect)新的更改。
有人可以帮助我如何散列“ Assets ”和“资源”文件夹的所有文件名以避免缓存这些文件吗?

Build Command: ng build --prod --aot --no-sourcemap --output-hash=all
操作系统 : 视窗 10
谢谢

最佳答案

只需在 angular.json 中将 outputHashing 设置为“all”文件

"projects": {
...
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"production": {
...
"outputHashing": "all",
...

关于用于散列 Assets 和资源文件夹的文件名的 Angular 构建过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50411349/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com