Skip to content

Commit 30d4981

Browse files
committed
refactor(es6): WebWorkerMainTemplatePlugin to use const rather than var
1 parent 4369dfa commit 30d4981

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

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) + " + \"";

0 commit comments

Comments
 (0)