在next15.2.1中的jest引入Bubble报错
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.2k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 2
Description
antd版本:5.24.3
"@ant-design/x": "^1.0.6"
包管理:pnpm
1. 根据https://nextjs.org/docs/app/building-your-application/testing/jest的配置好jest环境后,
MyComponent.tsx
```ts
import { Bubble } from "@ant-design/x";
export function MyComponent() {
return
}
```
demo.test.tsx
```ts
import { MyComponent } from "MyComponent";
console.log(MyCompoent)
```
# 结果
报错:
/node_modules/.pnpm/antd@5.24.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/antd/es/theme/useToken.js:9
import React from 'react';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the Next.js Jest setup, pnpm, and the examples in MyComponent.tsx and demo.test.tsx. Start by examining the reported import failure in antd/es/theme/useToken.js and compare it with the testing configuration from the linked Next.js guide. Done means the test can load MyComponent without the reported module syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100