Use hpcc-js-wasm with client-side React based on create-react-app #103
-
Hi, thanks for this package - comes in handy for using graphviz in the browser. I am using it with React and I have run into trouble to find a clean way to give the web-packed React-app a URL from whare it can load the .wasm file. As others, I ended up to manually copy the file into the public/js folder, from where it gets loaded. I am wondering whether anybody might have an idea how to access the file from where it originally sits - in the node-modules hierarchy. Best, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In general copying the wasm file to the same location the loader code has been bundled to is probably the simplest approach.
type of thing. You may need to tweak the relative path depending on your root folder and the location of your bundled folder. Note: GitHub has introduced a new "Discussions" tab above ^^^^^ where these types of questions might be better located! |
Beta Was this translation helpful? Give feedback.
-
Further - the reason I "prefer" the copying method is that I consider the wasm file to be a resource, similar to png, svg etc. and if you don't copy it, you will be in danger of forgetting to do so when you migrate your bundled package to a production server. |
Beta Was this translation helpful? Give feedback.
In general copying the wasm file to the same location the loader code has been bundled to is probably the simplest approach.
To nominate a different location you can call
wasmFolder(...url...)
prior to making graphviz calls:type of thing.
You may need to tweak the relative path depending on your root folder and the location of your bundled folder.
Note: GitHub has introduced a new "Discussions" tab above ^^^^^ where these types of questions might be better located!