VChart icon indicating copy to clipboard operation
VChart copied to clipboard

[Bug] Error: init chart fail

Open tangzijun opened this issue 9 months ago • 13 comments

Version

1.13.5

Link to Minimal Reproduction

1

Steps to Reproduce

1

Current Behavior

"next": "^15.1.7" "react": "^19.0.0"

Image

Image

Expected Behavior

不报错

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

tangzijun avatar Feb 23 '25 14:02 tangzijun

检查一下 VChart 引入方式

// 默认的引入方式,可以直接使用,图表无需注册
import VChart from '@visactor/vchart';

// 引入VChart 核心模块,图表需要手动注册
import { VChart } from '@visactor/vchart';

ps. 按需加载文档

xiaoluoHe avatar Feb 24 '25 03:02 xiaoluoHe

检查一下 VChart 引入方式

// 默认的引入方式,可以直接使用,图表无需注册 import VChart from '@visactor/vchart';

// 引入VChart 核心模块,图表需要手动注册 import { VChart } from '@visactor/vchart'; ps. 按需加载文档

我报错时使用的是第一种方式,修改成第二种方式后,能够正常。

但第一种使用方式报错应该依然是一个问题。

tangzijun avatar Feb 24 '25 09:02 tangzijun

@tangzijun 默认引入会报错的话是不太合理。请提供一个可以复现的 demo 吧

xiaoluoHe avatar Feb 24 '25 11:02 xiaoluoHe

+1, 最新版本我们也遇到了一样的问题,默认引入方式会报错“init fail”,必须通过第二种方式手动引入

LiuN1an avatar Mar 07 '25 09:03 LiuN1an

+1, 最新版本我们也遇到了一样的问题,默认引入方式会报错“init fail”,必须通过第二种方式手动引入

@LiuN1an 请提供一下版本号信息、以及如何图表的使用方式,最好有复现 demo 好定位。 我在 v1.13.6 没有复现问题,demo: codesandbox

Image

xiaoluoHe avatar Mar 18 '25 06:03 xiaoluoHe

我遇到同样的报错,vite, react. 在本地机器开发的好好的, 放到远程机器上就报错

Image

MingSeng-W avatar Mar 21 '25 09:03 MingSeng-W

我遇到同样的报错,vite, react. 在本地机器开发的好好的, 放到远程机器上就报错

Image

改成import VChart from '@visactor/vchart'; 报错就解决了

MingSeng-W avatar Mar 21 '25 09:03 MingSeng-W

我遇到同样的报错,vite, react. 在本地机器开发的好好的, 放到远程机器上就报错 Image

改成import VChart from '@visactor/vchart'; 报错就解决了

@MingSeng-W 你这个是因为之前用的按需方式引入的,本地开发环境 treeshaking 没生效; 改后是全量引入的,所以正常。 和 issue 原本问题不一样。

xiaoluoHe avatar Mar 24 '25 02:03 xiaoluoHe

@tangzijun @LiuN1an 感谢反馈,如果需要进一步针对 issue 反馈进行交流,欢迎扫码加入飞书群交流群:

xiaoluoHe avatar Mar 28 '25 02:03 xiaoluoHe

感谢反馈

Marco-Gd1013 avatar May 29 '25 08:05 Marco-Gd1013

我也遇到了本地机器上好好的,放到远程开发上就报错,需要改成怎么引入呢

Image

peddlerfans avatar Jun 10 '25 11:06 peddlerfans

Image 我今天第一次使用VChart,遇到了类似问题 本质上是开发者自己没有用好「默认引入」和「按需引入」,但如果没看到这条issue真有可能不知道怎么debug 我自己感觉,是否可以在错误提示上优化一下,使其输出的信息方便人类/ai debug,因为仅按照截图的信息查调用栈也是一头雾水 --- 我踩坑的路径是这样的 1. 描述自己需求+Trae帮我生成的一段的demo,它生成的代码是用的 import { VChart },其他都没问题 2. 打开浏览器debug,出现上述error 3. 粘贴错误上下文,继续追问Trae+调试无果 4. 找github issue,发现引入的区别,手动调整代码解决问题

miohan0623 avatar Nov 17 '25 08:11 miohan0623

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Image I used VChart for the first time today and encountered a similar problem Essentially, the developer himself did not make good use of "default import" and "on-demand import", but if you don't see this issue, you may not know how to debug it. I personally feel that the error message can be optimized to make the output information convenient for human/ai debugging, because it is confusing to check the call stack based only on the information in the screenshot. --- This is the path I took when I stepped on the pit: 1. Describe your needs + a demo generated by Trae for me. The code it generates uses import { VChart }, and everything else is fine. 2. Open the browser debug and the above error appears. 3. Paste the error context and continue to ask Trae+ debugging to no avail. 4. Find the github issue, discover the introduced differences, and manually adjust the code to solve the problem.

Issues-translate-bot avatar Nov 17 '25 08:11 Issues-translate-bot