-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Description
I think we're getting a false positive from the named ESM exports problem detection.
For @cerbos/core, we get a missing named exports problem for nearly everything exported from the package entrypoint.
The allegedly-missing exports are defined using export * from "./wherever" syntax so tsc produces JS like
__exportStar(require("./wherever"), exports);which does seem like it might not be statically analyzable, but it works in practice.
Given this package.json
{
"type": "module",
"private": true,
"dependencies": {
"@cerbos/core": "^0.18.1"
}
}and this index.mjs
import { Client } from "@cerbos/core";
console.log(Client);then Node.js (v20.17.0, at least) is able to resolve the named import of Client:
$ node index.mjs
[class Client]but attw reports problems from the "node16 (from ESM)" check, with Client (among others) listed as missing:
$ npx --yes @arethetypeswrong/cli --format json --from-npm @cerbos/core
{
...,
"problems": {
"NamedExports": [
{
"kind": "NamedExports",
"implementationFileName": "/node_modules/@cerbos/core/lib/index.js",
"typesFileName": "/node_modules/@cerbos/core/lib/index.d.ts",
"isMissingAllNamed": false,
"missing": [
"_addInstrumenter",
"_removeInstrumenter",
"_AbortHandler",
"Client",
...
]
}
]
}
}The weird thing is that I've tried creating a minimal reproduction on StackBlitz and it doesn't report any problems.
Metadata
Metadata
Assignees
Labels
No labels