Trouble loading .gltf models from external folder in Electron-forge app


I am running an electron app that loads and views different .gltf models in React-3-fiber. I was able to configure my webpack to load the models fine – but I would like the feature for clients to view different models in production, by having the application access them from an external folder that the client can add models to.

I can’t seem to figure out how to accomplish this. I realize this is sort of more of an electron question.

I’ve tried directly just handing the .gltf model to the useLoader function, but I guess it needs a path to the model, I can’t just give it the data directly.

I get an error here: "Could not load {//all the gltf data}.

Is there a way to directly load the .gltf model without a path, but with the data itself?

import {useLoader} from "@react-three/fiber";
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
export default function Modelfile() {

//Electron bridge function that gets the model from an external folder
 const gltf = window.main.model("modelName");

 console.log(gltf); //Logs the file correctly with all the data
const gltf = useLoader(GLTFLoader, gltf);
//ERROR, could not load {. . . correct gltf data}
return (
    <primitive object={gltf.scene} scale={[20, 20, 20]} rotation={[0, Math.PI, 0]} />

Appreciate any insights or tips. I’ve also been trying to figure out how to get the path itself, but I’m not sure if the renderer function can access the file system like that