antvis/G6


The issue has been closed
[Bug]: JSX-styled GNode tutorial page does not work #6879
divq posted onGitHub
Describe the bug / 问题描述
https://g6.antv.vision/examples/element/custom-node/#react-g 这个页面的教程说让使用这样的代码引入GNode
等
import { ExtensionCategory, Graph, register } from '@antv/g6';
import { GNode, Group, Image, Rect, Text } from '@antv/g6-extension-react';
但是在本地报错
<img width="929" alt="Image" src="https://github.com/user-attachments/assets/90d08734-11de-4872-8a4a-af77684c22e5" />
<img width="998" alt="Image" src="https://github.com/user-attachments/assets/02c082eb-00b2-461d-8f46-6f3927ad1ed9" />
查看node_modules里面依赖的此包,里面并没有export这些东西出来:
<img width="1214" alt="Image" src="https://github.com/user-attachments/assets/9e3b3249-9cf9-42f5-9ca3-befc1b57bf14" />
package.json
如下:
{
"name": "testcombiningjsintoone",
"version": "1.0.0",
"main": "webpack.config.js",
"scripts": {
"build": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@antv/g6": "latest",
"@antv/g6-extension-react": "latest",
"react": "18.1.0",
"react-dom": "18.1.0"
},
"devDependencies": {
"@antv/g6-react-node": "^1.4.8",
"@babel/core": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@types/react": "^19.0.11",
"babel-loader": "^10.0.0",
"ts-loader": "^9.5.2",
"typescript": "^5.8.2",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1"
}
}
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
No response
Version / 版本
Please select / 请选择
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他