Skip to content

Commit 1d32654

Browse files
committed
use const where applicable in UseStrictPlugin
1 parent e66a039 commit 1d32654

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎lib/UseStrictPlugin.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ class UseStrictPlugin {
1010
apply(compiler) {
1111
compiler.plugin("compilation", (compilation, params) => {
1212
params.normalModuleFactory.plugin("parser", (parser) => {
13-
let parserInstance = parser;
13+
const parserInstance = parser;
1414
parser.plugin("program", (ast) => {
15-
let firstNode = ast.body[0];
16-
let dep;
15+
const firstNode = ast.body[0];
1716
if(firstNode &&
1817
firstNode.type === "ExpressionStatement" &&
1918
firstNode.expression.type === "Literal" &&
2019
firstNode.expression.value === "use strict") {
2120
// Remove "use strict" expression. It will be added later by the renderer again.
2221
// This is necessary in order to not break the strict mode when webpack prepends code.
2322
// @see https://github.com/webpack/webpack/issues/1970
24-
dep = new ConstDependency("", firstNode.range);
23+
const dep = new ConstDependency("", firstNode.range);
2524
dep.loc = firstNode.loc;
2625
parserInstance.state.current.addDependency(dep);
2726
parserInstance.state.module.strict = true;

0 commit comments

Comments
 (0)