mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
- Keep CommonJS packages eligible for static compilation when export prologues precede require calls. - Preserve initialization order and early-access safeguards with frontend and native regression coverage. Fixes #37 Co-authored-by: vini <91087061+vinikjkkj@users.noreply.github.com>
10 lines
381 B
JavaScript
10 lines
381 B
JavaScript
// Publishing a hoisted function does not invoke it or read its captures.
|
|
// The dependency still initializes at the require, once across both users.
|
|
console.log('main: before');
|
|
const member = require('./member.cjs');
|
|
console.log(member.describe(), member.renamed());
|
|
const read = require('./single.cjs');
|
|
console.log(read());
|
|
require('./member.cjs');
|
|
console.log('main: after');
|