How to read external VTK file in React project


In VTK.js with React to read a VTK file we call this function to read a VTK file, we call this function with the directory of the VTK file (that must be in the public folder tree structure).

const reader1 = vtkPolyDataReader.newInstance();
       .then(async () => {
            pd = await reader1.getOutputData(0);

I need to read a VTK file from other “system directory”:


But that doesn’t work, I’ve read that I must re-configure the webpack file but I don’t know how to exactly do it

You can’t read from the filesystem like that unfortunately. You have to use a static file proxy server to be able to read files off of disk, or else manually open it via <input type=file>.