forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebWorkerChunkTemplate.js
More file actions
32 lines (28 loc) · 1.11 KB
/
WebWorkerChunkTemplate.js
File metadata and controls
32 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var ChunkTemplate = require("../ChunkTemplate");
function WebWorkerChunkTemplate(outputOptions) {
ChunkTemplate.call(this, outputOptions);
}
module.exports = WebWorkerChunkTemplate;
WebWorkerChunkTemplate.prototype = Object.create(ChunkTemplate.prototype);
WebWorkerChunkTemplate.prototype.renderHeader = function(chunk) {
var buf = ChunkTemplate.prototype.renderHeader.call(this, chunk);
var chunkCallbackName = this.outputOptions.chunkCallbackName || ("webpackChunk" + (this.outputOptions.library || ""));
buf.unshift(chunkCallbackName + "(" + JSON.stringify(chunk.ids) + ",");
return buf;
};
WebWorkerChunkTemplate.prototype.renderFooter = function(chunk) {
var buf = ChunkTemplate.prototype.renderFooter.call(this, chunk);
buf.push(")");
return buf;
};
WebWorkerChunkTemplate.prototype.updateHash = function(hash) {
ChunkTemplate.prototype.updateHash.call(this, hash);
hash.update("webworker");
hash.update("3");
hash.update(this.outputOptions.chunkCallbackName + "");
hash.update(this.outputOptions.library + "");
};