Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

Background

Importing simulateReadableStream from ai fails on GitHub Actions (Ubuntu) with Bun 1.3.3, while working locally on macOS:

SyntaxError: Export named 'simulateReadableStream' not found in module '.../node_modules/ai/dist/index.mjs'.

The export exists in the built output, but Bun's module resolution fails due to inconsistent export field configuration.

Summary

Added the module field to the main . export in packages/ai/package.json.

The ./internal and ./test subpath exports already had module fields, but the main export was missing it. This inconsistency caused Bun to fail module resolution on some environments.

".": {
  "types": "./dist/index.d.ts",
  "import": "./dist/index.mjs",
  "module": "./dist/index.mjs",  // Added
  "require": "./dist/index.js"
}

Manual Verification

  • Built the package and verified simulateReadableStream is exported correctly
  • Ran node and edge test suites (1539 tests pass)
  • Verified the export resolves via dynamic import

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)
Original prompt

This section details on the original issue you should resolve

<issue_title>SyntaxError: Export named 'simulateReadableStream' not found` on GitHub Actions but works locally</issue_title>
<issue_description>### Description

Environment

  • Bun: 1.3.3
  • AI SDK (ai): 5.0.108
  • OS: Ubuntu (GitHub Actions ubuntu-latest) vs macOS (local)

Description

Importing simulateReadableStream from the ai package works locally but fails on GitHub Actions with the same Bun version and --frozen-lockfile.

import { simulateReadableStream } from "ai";

Error on CI:

SyntaxError: Export named 'simulateReadableStream' not found in module '/home/runner/work/.../node_modules/ai/dist/index.mjs'.
    at loadAndEvaluateModule (2:1)

The export clearly exists in node_modules/ai/dist/index.mjs (verified locally). Using bun install --frozen-lockfile so the versions should be identical.

Reproduction

  • Local: ✅ works
  • GitHub Actions (ubuntu-latest): ❌ fails

Workaround

Importing from ai/test works on both environments, but simulateReadableStream is exported from the main ai package in v5.0.108.

AI SDK Version

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

<agent_instructions>investigate</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: lgrammel <205036+lgrammel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SyntaxError for simulateReadableStream in GitHub Actions fix(ai): add module field to main export for Bun compatibility Dec 19, 2025
Copilot AI requested a review from lgrammel December 19, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxError: Export named 'simulateReadableStream' not found` on GitHub Actions but works locally

2 participants