[GH-ISSUE #1041] [Bug] Top-level package exports arrays are rejected as invalid JSON #382

Closed
opened 2026-10-15 18:24:29 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @6639835 on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1041

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

A valid manifest with exports: ["./array.cjs"] returns unavailable and says the metadata is not valid package JSON. The real Node resolver selects array.cjs.

Reproduction

Inventory index.js, node_modules/demo/package.json containing {"exports":["./array.cjs"]}, and node_modules/demo/array.cjs in one container. Resolve demo with context: "module-specifier", moduleKind: "require". Node's createRequire(...).resolve("demo") succeeds on the same layout.

Reproduced with the production resolver; only the import suffix changed from .js to .ts. No packaged CLI/MCP run.

Expected behavior

Apply exports array selection at the top level as well as inside conditions and resolve the selected target.

Impact and scope

Valid packages using an exports fallback array lose their module relationship and receive misleading metadata diagnostics.

REA version

5.0.0; commit 2bf3663f65.

Runtime and platform

Node.js 26.10.0; macOS arm64.

Target and artifact context

JavaScript/HTML artifact inventory.

Interface

Other

Earliest failure stage

Artifact or evidence registration

Relevant output or evidence

Node: resolves array.cjs
REA: resolution_status: unavailable
Directory package metadata node_modules/demo/package.json is not valid package JSON.

Typed outcome or recovery expected

No response

Analysis or suspected cause

No response

Additional context

Resolver source

Originally created by @6639835 on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1041 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Evidence, artifacts, or reconstruction ### Observed behavior A valid manifest with `exports: ["./array.cjs"]` returns `unavailable` and says the metadata is not valid package JSON. The real Node resolver selects `array.cjs`. ### Reproduction Inventory `index.js`, `node_modules/demo/package.json` containing `{"exports":["./array.cjs"]}`, and `node_modules/demo/array.cjs` in one container. Resolve `demo` with `context: "module-specifier"`, `moduleKind: "require"`. Node's `createRequire(...).resolve("demo")` succeeds on the same layout. Reproduced with the production resolver; only the import suffix changed from .js to .ts. No packaged CLI/MCP run. ### Expected behavior Apply exports array selection at the top level as well as inside conditions and resolve the selected target. ### Impact and scope Valid packages using an exports fallback array lose their module relationship and receive misleading metadata diagnostics. ### REA version 5.0.0; commit 2bf3663f654386c9fd8c1437c49659df97bd4697. ### Runtime and platform Node.js 26.10.0; macOS arm64. ### Target and artifact context JavaScript/HTML artifact inventory. ### Interface Other ### Earliest failure stage Artifact or evidence registration ### Relevant output or evidence ```text Node: resolves array.cjs REA: resolution_status: unavailable Directory package metadata node_modules/demo/package.json is not valid package JSON. ``` ### Typed outcome or recovery expected _No response_ ### Analysis or suspected cause _No response_ ### Additional context [Resolver source](https://github.com/morluto/rea/blob/2bf3663f654386c9fd8c1437c49659df97bd4697/src/application/javascript/JavaScriptArtifactPathResolution.ts)
bsakaguchi 2026-10-15 18:24:29 +00:00
  • closed this issue
  • added the
    triage
    bug
    labels
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#382
No description provided.