Any way to use DracoLoader without going back to HTML import tags?

Hello, I’m developing a new Three.JS site, and I’m having a great time so far.

I’m importing everything as modules (the docs seem to suggest that as the preferred way to develop), but I’m stuck on getting Draco decoding working. Since it’s not provided as a module. It’s also not included in the 3rd party three-full npm module.

I saw some mention about a workaround using imports-loader but I don’t understand how it works. I can’t find any examples.

Am I missing something? Or is it just not possible to use draco compression and importing as modules at the same time?

DracoLoader will be available as a module with the next release R106 at the end of this month. Here is the current version from the dev branch.

3 Likes

Awesome! That’s great to hear.

Until that point, what would be the smartest way to keep moving? Switch to the dev branch? Move that file into my current installation?

Otherwise I can just wait and implement compression once R106 is released.

Thanks for the help!

If adding compression is a non time-ctritical task in your project, I would do this. In this way, you can use THREE.DracoLoader from the npm package.

However, you still have to copy the decoder files from the following directory to your project and refer to them via THREE.DRACOLoader.setDecoderPath(). It’s everything explained in the respective README (we are not sure how to handle these files yet so this remains a manual step).

https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco