使用Angular Cli自定义生成的文件名 [英] Custom generated filename with Angular Cli
问题描述
对于Angular-cli,使用ng build -prod
时生成的文件名为main.[hash] .bundle.js.
是否可以从该文件名中删除哈希表.所以只是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是默认的开发目标. 全部是生产目标的默认值.
none is the default for the development target. all is the default for the production target.
更多详细信息此处.
这篇关于使用Angular Cli自定义生成的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!