next.js
6e894d05 - Turbopack: respect the module-sync export condition (#93970)

Commit
46 days ago
Turbopack: respect the module-sync export condition (#93970) I set it to `::Unknown` because we the runtime may or may not support module-sync. So let's just trace both for now There is one problem though: https://nodejs.org/docs/latest-v26.x/api/packages.html#conditional-exports > "module-sync" - matches no matter the package is loaded via import, import() or require(). The format is expected to be ES modules that does not contain top-level await in its module graph - if it does, ERR_REQUIRE_ASYNC_MODULE will be thrown when the module is require()-ed. So we have multiple options: 1. We definitely want to respect module-sync for tracing. We don't really have to throw ERR_REQUIRE_ASYNC_MODULE here, Node.js will do it at runtime anyway. 2. ~~What about bundling? Either~~ - ~~Respect module-sync always, but don't throw ERR_REQUIRE_ASYNC_MODULE.~~ - ~~Respect module-sync always, and do throw a build error the module requires TLA. This would require a separate validation pass though.~~ - I'm not enabling it for bundling for now
Author
Parents
Loading