diff --git a/examples/commonjs/README.md b/examples/commonjs/README.md index fb85a0b1c08..86e9be62edc 100644 --- a/examples/commonjs/README.md +++ b/examples/commonjs/README.md @@ -9,15 +9,15 @@ You can also see the info messages webpack prints to console (for both normal an # example.js ``` javascript -var inc = require('./increment').increment; -var a = 1; +const inc = require('./increment').increment; +const a = 1; inc(a); // 2 ``` # increment.js ``` javascript -var add = require('./math').add; +const add = require('./math').add; exports.increment = function(val) { return add(val, 1); }; @@ -27,7 +27,7 @@ exports.increment = function(val) { ``` javascript exports.add = function() { - var sum = 0, i = 0, args = arguments, l = args.length; + let sum = 0, i = 0, args = arguments, l = args.length; while (i < l) { sum += args[i++]; } @@ -197,4 +197,4 @@ chunk {0} output.js (main) 329 bytes [entry] [rendered] cjs require ./increment [2] ./example.js 1:10-32 [2] ./example.js 69 bytes {0} [built] single entry .\example.js main -``` \ No newline at end of file +``` diff --git a/examples/commonjs/example.js b/examples/commonjs/example.js index 5b87a398285..d56b3cb0040 100644 --- a/examples/commonjs/example.js +++ b/examples/commonjs/example.js @@ -1,3 +1,3 @@ -var inc = require('./increment').increment; -var a = 1; -inc(a); // 2 \ No newline at end of file +const inc = require('./increment').increment; +const a = 1; +inc(a); // 2 diff --git a/examples/commonjs/increment.js b/examples/commonjs/increment.js index df19980e68a..5b6497cade5 100644 --- a/examples/commonjs/increment.js +++ b/examples/commonjs/increment.js @@ -1,4 +1,4 @@ -var add = require('./math').add; +const add = require('./math').add; exports.increment = function(val) { return add(val, 1); -}; \ No newline at end of file +};