Ruan Yifeng tutorial: http://es6.ruanyifeng.com/-sharpdo...
// a.mjs
import {bar} from "./b";
console.log("a.mjs");
console.log(bar);
export let foo = "foo";
// b.mjs
import {foo} from "./a";
console.log("b.mjs");
console.log(foo);
export let bar = "bar";
in the above code, a.mjs loads b.mjsreb. MJS and then loads a.mjs, which constitutes a circular load. Execute a.mjs, and the result is as follows.
$ node --experimental-modules a.mjs
b.mjs
ReferenceError: foo is not defined
above is the content of the tutorial.
I tested undefined,let in browser environment, didn"t I improve without variable declaration? Why undefined instead of not defined? I have two guesses myself, but neither of them is quite sure. Please give me some advice