antvis/G6

自定义react节点报错 #4697

Hemomoo posted onGitHub

Describe the bug

  1. 和3861 那个bug 一样的问题
  2. 电脑是m1芯片 3 node 版本我也切换过 看报错信息 是这个 yoga-layout-prebuilt 的问题

在yoga-layout-prebuilt github 中 也有人提了一个这个问题 vadimdemedes/yoga-layout-prebuilt#21

但是我在codesandbox 中没有重现这个问题 我用vite 重现创建一个项目也会有同样的错误

Your Example Website or App

Steps to Reproduce the Bug or Issue

  1. 用vite 创建一个react 的项目
  2. 安装@antv/g6-react-node
  3. 导入就会报错

Expected behavior

可以正常运行

Screenshots or Videos

<img width="1232" alt="image" src="https://github.com/antvis/G6/assets/33367187/512ffb74-7662-402d-bbda-1308388c9954">

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1] "dependencies": { "@antv/g6-react-node": "^1.4.5", "react": "^18.2.0", "react-dom": "^18.2.0" }, "devDependencies": { "@types/react": "^18.0.37", "@types/react-dom": "^18.0.11", "@vitejs/plugin-react": "^4.0.0", "eslint": "^8.38.0", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.3.4", "vite": "^4.3.9" }

Additional context

No response


我也遇到了这问题,您解决了吗

posted by Muxin-007 almost 2 years ago

浪费了一下午2小时时间。一直调试还是报错。整理了个最小复现集

https://github.com/n9e/fe/tree/g6-crash-with-vite

git clone git@github.com:n9e/fe.git
git checkout -b g6-crash-with-vite origin/g6-crash-with-vite
npm install
npm run dev

访问localhost:8765/g6 即可复现(记得要用 g6-crash-with-vite 分支的代码哈)

posted by guguji5 over 1 year ago

临时性解法: 使用patch,修改源码解决的。npm和pnpm都有patch功能

     }_nbind.addMethod = addMethod;function throwError(message) {
       throw new Error(message);
-    }_nbind.throwError = throwError;_nbind.bigEndian = false;_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
+    }_nbind.throwError = throwError;_nbind.bigEndian = false;var _a; _a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
       __extends(BindType, _super);function BindType() {
         var _this = _super !== null && _super.apply(this, arguments) || this;_this.heap = HEAPU32;_this.ptrSize = 4;return _this;
       }BindType.prototype.needsWireRead = function (policyTbl) {

_a前面加个var

posted by defghy about 1 year ago

临时性解法: 使用patch,修改源码解决的。npm和pnpm都有patch功能

     }_nbind.addMethod = addMethod;function throwError(message) {
       throw new Error(message);
-    }_nbind.throwError = throwError;_nbind.bigEndian = false;_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
+    }_nbind.throwError = throwError;_nbind.bigEndian = false;var _a; _a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
       __extends(BindType, _super);function BindType() {
         var _this = _super !== null && _super.apply(this, arguments) || this;_this.heap = HEAPU32;_this.ptrSize = 4;return _this;
       }BindType.prototype.needsWireRead = function (policyTbl) {

_a前面加个var

👍patch可以,但是感觉要放弃antv了🤣

posted by kanocence about 1 year ago

临时性解法: 使用patch,修改源码解决的。npm和pnpm都有patch功能

     }_nbind.addMethod = addMethod;function throwError(message) {
       throw new Error(message);
-    }_nbind.throwError = throwError;_nbind.bigEndian = false;_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
+    }_nbind.throwError = throwError;_nbind.bigEndian = false;var _a; _a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
       __extends(BindType, _super);function BindType() {
         var _this = _super !== null && _super.apply(this, arguments) || this;_this.heap = HEAPU32;_this.ptrSize = 4;return _this;
       }BindType.prototype.needsWireRead = function (policyTbl) {

_a前面加个var

👍patch可以,但是感觉要放弃antv了 🤣

可以发一下你那边patch 如何写的吗

posted by hxz1993 about 1 year ago

临时性解法: 使用patch,修改源码解决的。npm和pnpm都有patch功能

     }_nbind.addMethod = addMethod;function throwError(message) {
       throw new Error(message);
-    }_nbind.throwError = throwError;_nbind.bigEndian = false;_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
+    }_nbind.throwError = throwError;_nbind.bigEndian = false;var _a; _a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;var BindType = function (_super) {
       __extends(BindType, _super);function BindType() {
         var _this = _super !== null && _super.apply(this, arguments) || this;_this.heap = HEAPU32;_this.ptrSize = 4;return _this;
       }BindType.prototype.needsWireRead = function (policyTbl) {

_a前面加个var

👍patch可以,但是感觉要放弃antv了 🤣

可以发一下你那边patch 如何写的吗

image

只需要加上 var _a; 直接复制上面老哥的就可以

posted by kanocence about 1 year ago

@antv/g6-react-node 已不再维护,请使用 @antv/g6-extension-react (需要 G6 >= 5.0)

posted by Aarebecca 11 months ago

Fund this Issue

$0.00
Funded

Pull requests