this is just for the repo, and not the workspace Co-authored-by: Rares Matei <matei.rar@gmail.com>
29 lines
940 B
TypeScript
29 lines
940 B
TypeScript
// Originally from devkit.
|
|
// See: https://github.com/angular/angular-cli/blob/2c8b12f/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/utils.ts
|
|
export interface HashFormat {
|
|
chunk: string;
|
|
extract: string;
|
|
file: string;
|
|
script: string;
|
|
}
|
|
|
|
export function getOutputHashFormat(option: string, length = 20): HashFormat {
|
|
const hashFormats: { [option: string]: HashFormat } = {
|
|
none: { chunk: '', extract: '', file: '', script: '' },
|
|
media: { chunk: '', extract: '', file: `.[hash:${length}]`, script: '' },
|
|
bundles: {
|
|
chunk: `.[chunkhash:${length}]`,
|
|
extract: `.[contenthash:${length}]`,
|
|
file: '',
|
|
script: `.[hash:${length}]`,
|
|
},
|
|
all: {
|
|
chunk: `.[chunkhash:${length}]`,
|
|
extract: `.[contenthash:${length}]`,
|
|
file: `.[hash:${length}]`,
|
|
script: `.[hash:${length}]`,
|
|
},
|
|
};
|
|
return hashFormats[option] || hashFormats['none'];
|
|
}
|