question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'ToolItem' of undefined

See original GitHub issue

Expected Behavior

可以正常使用vue节点

Current Behavior

单独使用x6的时候没这个报错,引用x6-vue-shape的时候报这个错了

Possible Solution

Steps To Reproduce

  1. yarn add @antv/x6 @antv/x6-vue-shape
  2. import { Graph } from “@antv/x6”;
  3. import “@antv/x6-vue-shape”;
Error Message & Stack Trace

client.ts:13 [vite] connecting...
client.ts:43 [vite] connected.
vue-i18n.esm-bundler.js:46 You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
initFeatureFlags @ vue-i18n.esm-bundler.js:46
(anonymous) @ vue-i18n.esm-bundler.js:2216
index.js:15 antdv installed
TypeError: Cannot read property 'ToolItem' of undefined
    at button.ts:10
Promise.catch (async)
extractComponentsGuards @ vue-router.esm-bundler.js:2021
(anonymous) @ vue-router.esm-bundler.js:3082
Promise.then (async)
navigate @ vue-router.esm-bundler.js:3077
pushWithRedirect @ vue-router.esm-bundler.js:2972
push @ vue-router.esm-bundler.js:2911
install @ vue-router.esm-bundler.js:3289
use @ runtime-core.esm-bundler.js:4001
default @ install.ts:23
(anonymous) @ main.ts:11
vue-router.esm-bundler.js:72 [Vue Router warn]: Unexpected error when starting the router: Error: Couldn't resolve component "default" at "/data-exploration/user"
    at vue-router.esm-bundler.js:2025
warn @ vue-router.esm-bundler.js:72
(anonymous) @ vue-router.esm-bundler.js:3291
Promise.catch (async)
install @ vue-router.esm-bundler.js:3289
use @ runtime-core.esm-bundler.js:4001
default @ install.ts:23
(anonymous) @ main.ts:11

Additional Context

Your Environment

  • x6: 1.24.5
  • OS: macOS 11.4
  • Browser: edge 90

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
yesmeckcommented, Nov 24, 2021

为什么不在 X6 的代码里修复呢?这里的 namespace 不是 ES 的标准,所以导致用 ES modules 的方式 import ToolItem 时报错了。

3reactions
aov2005commented, Nov 29, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'ToolItem' of undefined · Issue #3413 ...
Describe the bug Throw error Uncaught TypeError: Cannot read property 'ToolItem' of undefined. And I've found an error in the bundle of ...
Read more >
Collision Detection / Cannot read property 'defaultView' of ...
As I pass my collision items into the check, bottom of code, I am getting an error 'Cannot read property 'defaultView' of undefined'....
Read more >
Cannot read property XXX of undefined的解决办法_ ...
出错的原因: 意思就出错的个标签没有定义,原因是html的执行顺序是从上到下,在标签还没有加载的时候该方法就被调用了. 解决办法有两个:.
Read more >
Cannot read property 'call' of undefined - Esri Community
My custom widget has a click event handler that works with a draw toolbar and a dojo deferred function to create a snapped...
Read more >
Ark Tools Command
Ark Taxidermy Tool Item ID and Spawn Command. I can't see the durability of ... An unexpected error occurred: Cannot read property 'forEach'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found