Pebble32 opened a new pull request, #77663:
URL: https://github.com/apache/airflow/pull/77663
The `exports` map of `@apache-airflow/ts-sdk` only offers the `import`
condition. So `require("@apache-airflow/ts-sdk")` fails with
`ERR_PACKAGE_PATH_NOT_EXPORTED`, even on Node 22.12+ where `require()` can load
ES modules.
Bundling a `require()` call with esbuild fails too, with `Could not resolve
"@apache-airflow/ts-sdk"`. TypeScript under `nodenext` accepts the same import
from a CommonJS file, so a project type checks and then fails at runtime.
This switches the condition to `default` for the root, `coordinator` and
`hitl` entry points. Anything that matched `import` falls through to `default`,
so ESM consumers get the same files as before.
`verify-package` now also `require()`s every entry point from the packed
tarball. It fails on the old map with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
I packed main and this branch and installed each tarball into a fresh
CommonJS project. On main `require()` fails and the esbuild CommonJS bundle
doesn't build. With this change both work, and ESM `import` works the same on
both.
On Node 22.11 and older, where `require()` of ES modules is still behind a
flag, the error changes from `ERR_PACKAGE_PATH_NOT_EXPORTED` to
`ERR_REQUIRE_ESM`. ESM users on any Node 22 are not affected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]