-
Hello, I'm trying to create a utility ts package that has a function to read glTF and GLB files, and get their bounding box using The Does anyone have any suggestions on how I should import and install the draco decoders so that I could support both browser and Node.js environments? This is how I implement it right now - mostly following the doc and previous discussions.
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ideally Draco would publish web-ready ESM builds to npm, see: But since the official builds on npm are only for Node.js, I think it's necessary to either add global script tags to the application page (not ideal for a library to do this, as you mention) or to compile Draco from source with different emscripten configuration. |
Beta Was this translation helpful? Give feedback.
Thanks for the reply! I managed to get it working on both browser and node.js by downloading the decoder scripts (js and wsam) from https://github.com/google/draco/tree/main/javascript to my package, and importing the decoder directly from the js script. This script seems to have a environment branching logic for browser and node.js