The issue here is that @antv/x6 is published as an ES module, and the Blocks CLI currently only supports commonjs node dependencies. This is a known limitation which we’re working on improving.
In the meantime, you should be able to work around this if you can access a commonjs-compatible version of the bundle. Looking briefly, it appears ant also builds a UMD formatted bundle at dist/x6.js which would work for the block. You could try deep referencing this in your import statement (import x6 from '@antv6/x6/dist/x6'), or loading it from unpkg (https://unpkg.com/@antv/x6@1.1.1/dist/x6.js) directly.
Thanks. It’s a relative solution. But when I use the umd version, I will lose the type defination. It will be panic to use this.
When will the block sdk solve this kind of problem?
It blocks me long time and sucks really.
This is something we’re looking into, but unfortunately we don’t have any sort of timeline yet for when the issue might be resolved.
As a workaround to use the UMD version and still get type definitions, you could try using an extra .d.ts file to point the UMD module to the proper types like this: