Skip to content

Commit cbb0389

Browse files
authored
Replace export let with export var
When running through the `(require ... :reload)` example, I got an error message from Node: SyntaxError: Identifier 'sayHello$$module$src$js$hello' has already been declared at /home/rei/repos/hello-es6/.cljs_node_repl/src/js/hello.js:1:1 at ContextifyScript.Script.runInThisContext (vm.js:26:33) at Object.exports.runInThisContext (vm.js:79:17) at nodeGlobalRequire (repl:85:6) at global.CLOSURE_IMPORT_SCRIPT (repl:75:3) at Object.goog.require (repl:21:8) at repl:1:6 at ContextifyScript.Script.runInThisContext (vm.js:26:33) at Object.exports.runInThisContext (vm.js:79:17) at Domain.<anonymous> ([stdin]:50:34) This was due to the fact that Node (my version is 7.4.0) disallows redefinining anything declared with a `let`. Cf: nodejs/node#6118 This commit replace any `export let` with an `export var` which can be refined without error.
1 parent 4ea3c8e commit cbb0389

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎content/guides/javascript-modules.adoc‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Edit this file to look like the following:
142142

143143
[source,javascript]
144144
----
145-
export let sayHello = function() {
145+
export var sayHello = function() {
146146
console.log("Hello, world!");
147147
};
148148
----
@@ -206,10 +206,10 @@ Without quitting your REPL, edit `src/js/hello.js` to the following:
206206

207207
[source,javascript]
208208
----
209-
export let sayHello = function() {
209+
export var sayHello = function() {
210210
console.log("Hello, world!");
211211
};
212-
export let sayThings = function(xs) {
212+
export var sayThings = function(xs) {
213213
for(let x of xs) {
214214
console.log(x);
215215
}
@@ -298,15 +298,15 @@ Let's add a React JSX component to `src/js/hello.js`:
298298

299299
[source,javascript]
300300
----
301-
export let sayHello = function() {
301+
export var sayHello = function() {
302302
console.log("Hello, world!");
303303
};
304-
export let sayThings = function(xs) {
304+
export var sayThings = function(xs) {
305305
for(let x of xs) {
306306
console.log(x);
307307
}
308308
};
309-
export let reactHello = function() {
309+
export var reactHello = function() {
310310
return <div>Hello world!</div>
311311
};
312312
----

0 commit comments

Comments
 (0)