Skip to content

[bug] No "exports" main defined in /path/to/node_modules/@arizeai/openinference-genai/package.json #2504

@syl67

Description

@syl67

Describe the bug

The @arizeai/openinference-genai package fails to load when imported through @mastra/arize in a CommonJS environment. Node.js throws an error: "No 'exports' main defined" because the package only defines ESM (import) exports in its package.json, but no CommonJS (require) exports.

To Reproduce

  1. Install @mastra/arize (version ^0.1.1) which depends on @arizeai/openinference-genai
  2. Import ArizeExporter from @mastra/arize in a TypeScript file
  3. Run the application using ts-node-dev (which compiles to CommonJS by default)
  4. The application will crash with the following error:
Error: No "exports" main defined in /path/to/node_modules/@arizeai/openinference-genai/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:604:13)
    at resolveExports (node:internal/modules/cjs/loader:657:36)
    at Function._findPath (node:internal/modules/cjs/loader:749:31)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1387:27)
    ...

Expected behavior

The @arizeai/openinference-genai package should provide both ESM and CommonJS exports in its package.json to support both module systems, or at minimum provide a fallback main field for CommonJS compatibility.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS (darwin 24.6.0)
  • Node.js Version: 22.x
  • Package Version: @arizeai/[email protected]

Additional context

The @arizeai/openinference-genai package.json currently has:

  • "type": "module" (ESM-only)
  • exports field with only "import" conditions, no "require" conditions
  • No main field for CommonJS fallback

This causes issues when:

  • The consuming application uses CommonJS (via ts-node-dev or compiled TypeScript)
  • The package is imported transitively through @mastra/arize

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions