antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.06k stars 1.31k forks source link

G6引用循环依赖问题 #2689

Closed wisdomsuper closed 1 year ago

wisdomsuper commented 3 years ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

抱歉重现链接无法重新,怀疑webpack 3的关系 G6 会引用到g-webgpu-core这个包 import G6 from '@antv/g6/es';

此处跟直接引入这个依赖报错一致 import { GeometryComponent } from '@antv/g-webgpu-core/es/components/geometry/GeometryComponent';

错误信息:Uncaught TypeError: Super expression must either be null or a function image

原因:循环依赖导致了错误 @antv/g-webpu-core/es/components/geometry/GeometryComponent 中有这样一个依赖

image

解决方式: 我修改源码后错误消失,同样的在其他Component中也有这样的引用,需要同步修改 应修改为 import { Component } from '../../ComponentManager';

Environment Info
g6 4.1.12
System -
Browser -
xiaoiver commented 3 years ago

我发布了 g-webgpu-core@0.5.4,然后使用 create-react-app 创建了 react 项目使用到 webpack@4.44.2 版本。 并没有复现这个问题,我会尝试下 webpack3

wisdomsuper commented 3 years ago

我发布了 g-webgpu-core@0.5.4,然后使用 create-react-app 创建了 react 项目使用到 webpack@4.44.2 版本。 并没有复现这个问题,我会尝试下 webpack3

你好,我重现了 https://codesandbox.io/s/naughty-shannon-rc3lp?file=/webpack.config.js

这个地址,进去之后再terminal中执行yarn start,或者把项目弄下来执行

image

wisdomsuper commented 3 years ago

@Yanyan-Wang @xiaoiver 请问这个问题会修复吗?这是webpack3的关系,在这种引用模式下,webpack3打包出来的引用顺序 会有问题

Yanyan-Wang commented 3 years ago

@Yanyan-Wang @xiaoiver 请问这个问题会修复吗?这是webpack3的关系,在这种引用模式下,webpack3打包出来的引用顺序 会有问题

建议使用 webpack4 ~

Yanyan-Wang commented 1 year ago

由于您的 issue 长时间没有回复,我们无法根据你提供的信息给出解答,所以暂时关闭这个 issue。若有新的进展,可随时新开 issue。