Skip to main content

Jest: cannot find module '@ai-sdk/rsc'

还没翻译译自英文(ai-sdk.dev)本页 6 段都还没译

Issue

I am using AI SDK RSC and am writing tests for my RSC components with Jest.

I am getting the following error: Cannot find module '@ai-sdk/rsc'.

Solution

Configure the module resolution via jest config update in moduleNameMapper:

"moduleNameMapper": {
  "^@ai-sdk/rsc$": "<rootDir>/node_modules/@ai-sdk/rsc/dist"
}