You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And so "fn" isn't defined as b.js executes before a.js entirely, no exports are permitted before the require statement.
Now one naive fix for this particular case would be to use a function binding in the output, as these hoist through circular references in ES modules. That would only fix exported functions though, so executed binding values would still throw. This may possibly be adequate though as most test cases are functions as classes, as it seems from most of the bug reports. So it could be an interesting first step to try, although would be invalidated by a single exports.x = 'evaluated value'; require('./circular') bug.
The text was updated successfully, but these errors were encountered:
Here is a code example of what is breaking with cycles:
a.js
b.js
The issue is that this gets converted into an ES module tree looking like:
a.js
b.js
And so "fn" isn't defined as b.js executes before a.js entirely, no exports are permitted before the require statement.
Now one naive fix for this particular case would be to use a function binding in the output, as these hoist through circular references in ES modules. That would only fix exported functions though, so executed binding values would still throw. This may possibly be adequate though as most test cases are functions as classes, as it seems from most of the bug reports. So it could be an interesting first step to try, although would be invalidated by a single
exports.x = 'evaluated value'; require('./circular')
bug.The text was updated successfully, but these errors were encountered: