Files
scriptc/tests/diagnostics/cjs-require-tdz/main.js
2026-07-22 18:08:04 -05:00

15 lines
443 B
JavaScript

// A require whose binding IS reachable from code above it: Node would
// throw "Cannot access 'greet' before initialization" at the helper()
// call (the const initializes AT the require), an ordering the compiled
// aliasing does not model — the require keeps a named SC1013 fence.
'use strict';
console.log('boot', helper());
const { greet } = require('./lib.js');
function helper() {
return greet('early');
}
console.log(helper());