Skip to content

Commit 045219e

Browse files
authored
Merge pull request webpack#4322 from sendilkumarn/refactor-ww2
Refactor webworker var -> const changes
2 parents f4c04d8 + 75d15a9 commit 045219e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/webworker/WebWorkerMainTemplatePlugin.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
"use strict";
66

7-
var Template = require("../Template");
7+
const Template = require("../Template");
88

99
class WebWorkerMainTemplatePlugin {
1010
apply(mainTemplate) {
@@ -27,7 +27,7 @@ class WebWorkerMainTemplatePlugin {
2727
return source;
2828
});
2929
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
30-
var chunkFilename = this.outputOptions.chunkFilename;
30+
const chunkFilename = this.outputOptions.chunkFilename;
3131
return this.asString([
3232
"// \"1\" is the signal for \"already loaded\"",
3333
"if(!installedChunks[chunkId]) {",
@@ -49,7 +49,7 @@ class WebWorkerMainTemplatePlugin {
4949
});
5050
mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
5151
if(chunk.chunks.length > 0) {
52-
var chunkCallbackName = this.outputOptions.chunkCallbackName || Template.toIdentifier("webpackChunk" + (this.outputOptions.library || ""));
52+
const chunkCallbackName = this.outputOptions.chunkCallbackName || Template.toIdentifier("webpackChunk" + (this.outputOptions.library || ""));
5353
return this.asString([
5454
source,
5555
"this[" + JSON.stringify(chunkCallbackName) + "] = function webpackChunkCallback(chunkIds, moreModules) {",
@@ -66,10 +66,10 @@ class WebWorkerMainTemplatePlugin {
6666
return source;
6767
});
6868
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
69-
var hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
70-
var hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
71-
var hotUpdateFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
72-
var currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
69+
const hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
70+
const hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
71+
const hotUpdateFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
72+
const currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
7373
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
7474
hashWithLength: function(length) {
7575
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
@@ -78,7 +78,7 @@ class WebWorkerMainTemplatePlugin {
7878
id: "\" + chunkId + \""
7979
}
8080
});
81-
var currentHotUpdateMainFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateMainFilename), {
81+
const currentHotUpdateMainFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateMainFilename), {
8282
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
8383
hashWithLength: function(length) {
8484
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";

lib/webworker/WebWorkerTemplatePlugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55
"use strict";
66

7-
var WebWorkerMainTemplatePlugin = require("./WebWorkerMainTemplatePlugin");
8-
var WebWorkerChunkTemplatePlugin = require("./WebWorkerChunkTemplatePlugin");
9-
var WebWorkerHotUpdateChunkTemplatePlugin = require("./WebWorkerHotUpdateChunkTemplatePlugin");
7+
const WebWorkerMainTemplatePlugin = require("./WebWorkerMainTemplatePlugin");
8+
const WebWorkerChunkTemplatePlugin = require("./WebWorkerChunkTemplatePlugin");
9+
const WebWorkerHotUpdateChunkTemplatePlugin = require("./WebWorkerHotUpdateChunkTemplatePlugin");
1010

1111
class WebWorkerTemplatePlugin {
1212
apply(compiler) {

0 commit comments

Comments
 (0)