Get relative three path in VITE?

I am using VITE and I must get a reference to the three paths to load a gltf model, so far I used this.

const THREE_PATH = `${REVISION}.x`

I need to replace it with my local three-path.

if you’re using vite i don’t know why you would want to use a cdns?

import { REVISION } from 'three'

if you want to load a gltf, it’s supposed to be in /public, you shouldn’t use gltf but glb, then you also don’t need to mess with extra paths, but if you have to the gltf loader has a method to inject resource paths.

I am using it in a different way…

const MANAGER = new LoadingManager();
const THREE_PATH = `${REVISION}.x`;
const DRACO_LOADER = new DRACOLoader(MANAGER).setDecoderPath(
const KTX2_LOADER = new KTX2Loader(MANAGER).setTranscoderPath(

I am answering my own question:slight_smile:

const MANAGER = new LoadingManager();
const DRACO_LOADER = new DRACOLoader(MANAGER).setDecoderPath('three/examples/jsm/libs/draco/gltf/');
const KTX2_LOADER = new KTX2Loader(MANAGER).setTranscoderPath('three/examples/jsm/libs/basis/');

ahh, decoder paths. i suggest you use the official google cdn in that case: though basis i have no idea if an official cdn exists.

1 Like