GeezerVison is showing github.com — more tests and fixes for webworker · webpack/webpack@b018bc7
File treeExpand file treeCollapse file tree Open diff view settings test/configCases/hash-length/output-filename
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/webworker/WebWorkerMainTemplatePlugin.js +19-19Lines changed: 19 additions & 19 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,27 +51,27 @@ class WebWorkerMainTemplatePlugin { | 51 | 51 | length | 52 | 52 | )} + "`, | 53 | 53 | 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 | + } | 70 | 70 | } | | 71 | + return `" + ${JSON.stringify( | | 72 | + shortContentHashMap | | 73 | + )}[chunkId] + "`; | 71 | 74 | } | 72 | | - return `" + ${JSON.stringify( | 73 | | - shortContentHashMap | 74 | | - )}[chunkId] + "`; | 75 | 75 | } | 76 | 76 | }, | 77 | 77 | contentHashType: "javascript" | |
Collapse file Copy file name to clipboardExpand all lines: test/configCases/hash-length/output-filename/test.config.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,5 +47,6 @@ module.exports = { | 47 | 47 | }, | 48 | 48 | afterExecute: () => { | 49 | 49 | delete global.webpackJsonp; | | 50 | + delete global.webpackChunk; | 50 | 51 | } | 51 | 52 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/configCases/hash-length/output-filename/webpack.config.js +28Lines changed: 28 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -191,6 +191,34 @@ module.exports = [ | 191 | 191 | expectedFilenameLength: 9 + 7 + 3, | 192 | 192 | expectedChunkFilenameLength: 2 + 9 + 7 + 3 | 193 | 193 | } | | 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 | + } | 194 | 222 | } | 195 | 223 | ]; | 196 | 224 |
| |
|