antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.16k stars 1.33k forks source link

An error is reported when you use WorkEnable #6529

Open WangHanZ opened 1 week ago

WangHanZ commented 1 week ago

Describe the bug / 问题描述

layout failed DOMException: Failed to execute 'postMessage' on 'Worker': function () { } could not be cloned. at LayoutController.runWebworker (webpack-internal:///./node_modules/@antv/g6-pc/es/graph/controller/layout.js:500:14) at eval (webpack-internal:///./node_modules/@antv/g6-pc/es/graph/controller/layout.js:455:22)

将layout.min.js放在了dcn地址也可以访问 到这个layout.min.js文件, this.topoGraph.data({ nodes: obj.nodes, edges: obj.edges }) this.topoGraph.updateLayout({ type: 'force2', clustering: true, animate: false, nodeClusterBy: 'comboId', linkDistance: 20, // 可选,边长 nodeStrength: 60, // 可选 nodeSize: 10, edgeStrength: 15, workerEnabled: true, workerScriptURL: ${window.location.origin}/layout.min.js,

        onLayoutEnd: () => { // 可选
          this.topoGraph.fitCenter()
        }
      })
      this.topoGraph.render()

但是执行得时候汇报这个错误

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

4.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response