I'm facing the below error after upgrading d3-graphviz dependency version from 2.6.1 to 4.1.1 while rendering the graph using d3 and Graphviz. I didn't encounter this error with version 2.6.1. Can someone please help me in resolving this issue?
Uncaught (in promise) RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @ 0). Build with -s ASSERTIONS=1 for more info.
at abort (index.js:6:1)
at index.js:6:1
Here are the dependencies used for reference:
"d3": "6.6.1",
"d3-graphviz": "4.1.1",
"fs": "0.0.1-security"
I've also added the below script in the index.html file
<script src="https://unpkg.com/@hpcc-js/wasm/dist/index.min.js" type="application/javascript/"></script>
I'm also adding the code snippet for reference
import * as d3 from "d3";
import * as d3Graphviz from "d3-graphviz"
import "./styles.css";
d3.select("#app").graphviz().renderDot(graphString);
CodePudding user response:
The issue is resolved after adding the below import statement and setting wasmfolder.
import { wasmFolder } from "@hpcc-js/wasm";
wasmFolder("https://unpkg.com/@hpcc-js/wasm/dist/");
Note: WASM files are dynamically loaded at runtime (this is a browser / emscripten requirement)