安装x6-vue-shape后会报错
vite项目下,安装引入@antv/x6-vue-shape会报错只安装@antv/x6正常,安装x6-vue-shape后会报错1、安装@antv/x6-vue-shape2、import { Graph } from “@antv/x6”;3、报错button.ts:10Uncaught TypeError: Cannot read properties of undefined (readi
·
vite项目下,安装引入@antv/x6-vue-shape会报错
只安装@antv/x6正常,安装x6-vue-shape后会报错
1、安装@antv/x6-vue-shape
2、import { Graph } from “@antv/x6”;
3、报错button.ts:10
Uncaught TypeError: Cannot read properties of undefined (reading 'ToolItem');
版本
"@antv/x6": "^1.30.0",
"@antv/x6-vue-shape": "^1.3.1",
解决方案
// vite.config.js
resolve: {
alias: [
{
find: '@antv/x6',
replacement: '@antv/x6/lib'
},
{
find: '@antv/x6-vue-shape',
replacement: '@antv/x6-vue-shape/lib',
},
]
},
如 replacement: @antv/x6/lib
不起作用,请设置为 @antv/x6/dist/x6.js
,否则 build
后会产生错误。
注:vite 问题可以参考 https://github.com/vitejs/vite/issues/3413
更多推荐
已为社区贡献7条内容
所有评论(0)