fix: avoid importing non-exported ai/dist#1541
fix: avoid importing non-exported ai/dist#1541kr1shna-exe wants to merge 1 commit intobrowserbase:mainfrom
Conversation
|
Greptile SummaryChanged the import statement from Key Changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant TS as TypeScript Compiler
participant AI as ai Package
participant AP as AgentProvider
Note over Dev,AP: Before: import from ai/dist
Dev->>TS: Build with NodeNext resolution
TS->>AI: Resolve ai/dist
AI-->>TS: ❌ Not in exports field
TS-->>Dev: Type check fails
Note over Dev,AP: After: import from ai
Dev->>TS: Build with NodeNext resolution
TS->>AI: Resolve ai
AI-->>TS: ✅ Found in exports field
TS->>AP: Load ToolSet type
AP-->>TS: ✅ Type available
TS-->>Dev: Build succeeds
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
Why
Under
moduleResolution: "NodeNext"with full type checking enabled, the build fails because the code attempts to importai/dist, which is not exposed via theaipackageexportsfield.This import is tolerated under less strict module resolution settings, but NodeNext rejects it due to it's strict nature.
What changed
Updated the import to reference the public
aientry point instead of the non-exportedai/distpath, aligning the code with the package’s declared exports.Test plan
tsc --noEmitwithmoduleResolution: "NodeNext"Fixes #1531
Summary by cubic
Switched ToolSet import from "ai/dist" to the public "ai" entry to comply with package exports and NodeNext strict resolution, fixing TypeScript type-check failures.
Build now passes with moduleResolution: "NodeNext" and strict type checking.
Written for commit b1ff6fe. Summary will update on new commits.