-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): add webpack output hashing option
- Loading branch information
1 parent
feb155d
commit 339b230
Showing
8 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './hmr/hot-update-utils'; | ||
export * from './output-utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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']; | ||
} |