antvis / antvis/G6

[Bug]: 在vite项目中引入@antv/g6后报错

Open
#7,272 1 comment 0 reactions 0 assignees View on GitHub
question 💬
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

在vite项目中引入@antv/g6后报错:Cannot read properties of undefined (reading 'Graph')
at node_modules/.pnpm/dagre@0.8.5/node_modules/dagre/lib/greedy-fas.js

```js
import { Graph } from '@antv/g6'
```

Image

### Reproduction link / 复现链接

_No response_

### Steps to Reproduce the Bug or Issue / 重现步骤

_No response_

### Version / 版本

🆕 5.x

### OS / 操作系统

- [ ] macOS
- [x] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Vite import shown in the issue, using the reported Windows and Chrome environment if possible. Read the stack trace through node_modules/.pnpm/dagre@0.8.5/node_modules/dagre/lib/greedy-fas.js and identify why importing Graph produces an undefined value. Done means the @antv/g6 import works in a Vite project without the reported Graph error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.