File tree Expand file tree Collapse file tree 3 files changed +48
-19
lines changed
test/configCases/hash-length/output-filename Expand file tree Collapse file tree 3 files changed +48
-19
lines changed Original file line number Diff line number Diff line change @@ -51,27 +51,27 @@ class WebWorkerMainTemplatePlugin {
5151 length
5252 ) } + "`,
5353 chunk : {
54- id : '" + chunkId + "'
55- } ,
56- contentHash : {
57- javascript : `" + ${ JSON . stringify (
58- chunkMaps . contentHash . javascript
59- ) } [chunkId] + "`
60- } ,
61- contentHashWithLength : {
62- javascript : length => {
63- const shortContentHashMap = { } ;
64- const contentHash = chunkMaps . contentHash . javascript ;
65- for ( const chunkId of Object . keys ( contentHash ) ) {
66- if ( typeof contentHash [ chunkId ] === "string" ) {
67- shortContentHashMap [ chunkId ] = contentHash [
68- chunkId
69- ] . substr ( 0 , length ) ;
54+ id : '" + chunkId + "' ,
55+ contentHash : {
56+ javascript : `" + ${ JSON . stringify (
57+ chunkMaps . contentHash . javascript
58+ ) } [chunkId] + "`
59+ } ,
60+ contentHashWithLength : {
61+ javascript : length => {
62+ const shortContentHashMap = { } ;
63+ const contentHash = chunkMaps . contentHash . javascript ;
64+ for ( const chunkId of Object . keys ( contentHash ) ) {
65+ if ( typeof contentHash [ chunkId ] === "string" ) {
66+ shortContentHashMap [ chunkId ] = contentHash [
67+ chunkId
68+ ] . substr ( 0 , length ) ;
69+ }
7070 }
71+ return `" + ${ JSON . stringify (
72+ shortContentHashMap
73+ ) } [chunkId] + "`;
7174 }
72- return `" + ${ JSON . stringify (
73- shortContentHashMap
74- ) } [chunkId] + "`;
7575 }
7676 } ,
7777 contentHashType : "javascript"
Original file line number Diff line number Diff line change @@ -47,5 +47,6 @@ module.exports = {
4747 } ,
4848 afterExecute : ( ) => {
4949 delete global . webpackJsonp ;
50+ delete global . webpackChunk ;
5051 }
5152} ;
Original file line number Diff line number Diff line change @@ -191,6 +191,34 @@ module.exports = [
191191 expectedFilenameLength : 9 + 7 + 3 ,
192192 expectedChunkFilenameLength : 2 + 9 + 7 + 3
193193 }
194+ } ,
195+ {
196+ name : "contenthash in webpack" ,
197+ entry : "./no-async" ,
198+ output : {
199+ filename : "bundle16.[contenthash].js" ,
200+ chunkFilename : "[id].bundle16.[contenthash].js" ,
201+ globalObject : "this"
202+ } ,
203+ target : "webworker" ,
204+ amd : {
205+ expectedFilenameLength : 32 ,
206+ expectedChunkFilenameLength : 34
207+ }
208+ } ,
209+ {
210+ name : "contenthash in async-node with length" ,
211+ entry : "./no-async" ,
212+ output : {
213+ filename : "bundle17.[contenthash:7].js" ,
214+ chunkFilename : "[id].bundle17.[contenthash:7].js" ,
215+ globalObject : "this"
216+ } ,
217+ target : "webworker" ,
218+ amd : {
219+ expectedFilenameLength : 9 + 7 + 3 ,
220+ expectedChunkFilenameLength : 2 + 9 + 7 + 3
221+ }
194222 }
195223] ;
196224
You can’t perform that action at this time.
0 commit comments