-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep dynamic requires synchronous in module #9
Comments
commit 8071336 has modified the behavior to always hoist static imports from requires, unless the block in commonjs is already async. |
in addition to circular and conditional requires, the case of optional requires has been handled in commit 46841c3. |
meta/sanitize currently converts dynamic requires to awaited dynamic imports,
along with making their corresponding enclosing functions async.
This was a tradeoff to support conditional dependency (
if(true)require()
) instead of all being hoisted as a static import to keep them synchronous.Synchronous internal or peer dependant calls to the resulting asynchronized functions can be edited to be async as well, but this can get complex beyond simple library initializations, in eg. opaque object hierarchies.
Such peers, relying extensively on commonjs's synchronous loading of what are supposed to be modules, may deserve to be deprecated.
The text was updated successfully, but these errors were encountered: