GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — more tests and fixes for webworker · webpack/webpack@b018bc7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/webworker
    • WebWorkerMainTemplatePlugin.js
  • test/configCases/hash-length/output-filename
    • test.config.js
    • webpack.config.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/webworker/WebWorkerMainTemplatePlugin.js‎

Copy file name to clipboardExpand all lines: lib/webworker/WebWorkerMainTemplatePlugin.js
+19-19Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff 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"
Collapse file

‎test/configCases/hash-length/output-filename/test.config.js‎

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 numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ module.exports = {
4747
},
4848
afterExecute: () => {
4949
delete global.webpackJsonp;
50+
delete global.webpackChunk;
5051
}
5152
};
Collapse file

‎test/configCases/hash-length/output-filename/webpack.config.js‎

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 numberDiff line numberDiff 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

0 commit comments

Comments
0 (0)
You are visitor 01402605 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.