解决方法:
如果是普通vue项目,在vite.config.js中加如下配置
···js
optimizeDeps: {
exclude: ['@antv/x6-plugin-dnd']
},
```
如果是quasar项目,在 quasar.config.js 文件中,加如下配置
```js
extendViteConf (viteConf) {
viteConf.optimizeDeps = {
// 用于解决引入@antv/x6-plugin-dnd后,
// 报Cannot read property 'ToolItem' of undefined错误的问题
exclude: ['@antv/x6-plugin-dnd']
}
},
```
参考资料:
https://github.com/vitejs/vite/issues/3413#issuecomment-1180169375
欢迎关注公众号:清晰编程,获取更多精彩内容