使用 Angular Cli 自定义生成的文件名 [英] Custom generated filename with Angular Cli
问题描述
使用 Angular-cli 构建的文件名为 main.[hash].bundle.js 当使用 ng build -prod
是否可以删除此文件名的哈希表.所以只是main.bundle.js
?
With Angular-cli the builded filename is main.[hash].bundle.js when use ng build -prod
Is it possible to remove the hash form this filename. So just main.bundle.js
?
推荐答案
从 beta.25 开始,现在通过命令选项支持它.
It's now supported via a command option as of beta.25.
这允许在构建期间通过新的构建命令选项 --output-hashing
配置输出文件名哈希.有四个可能的值:
This allows the output filename hashes to be configured during a build via a new build command option
--output-hashing
. There are four possible values:
none
:不执行哈希
media
:只向通过 [url|file]-loaders 处理的文件添加哈希值
media
: only add hashes to files processed via [url|file]-loaders
bundles
:只向输出包添加哈希值
bundles
: only add hashes to the output bundles
all
:向媒体和捆绑包添加哈希
all
: add hashes to both media and bundles
none 是开发目标的默认值.all 是生产目标的默认值.
none is the default for the development target. all is the default for the production target.
更多详情此处.
这篇关于使用 Angular Cli 自定义生成的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!