I use Snowpack to serve the examples in this repository: glTF-Transform-Render ā¦ I havenāt tried fetching .hdr files with an import statement there, but it does let me use their relative URLs just fine. I donāt think Iāve done anything special to support that, but would note that Snowpack doesnāt like to serve any files outside of the project root directory.
Will it work if I keep the assets in the src folder? It doesnāt work for me then, so I tried keeping the assets folder outside of the src folder(like what you did), and instead do āā¦/assets/royal_esplanade_1k.hdrā. That didnāt work either.
I got: Not Found (/assets/royal_esplanade_1k.hdr). Were you able to do these kinds of imports when using snowpack dev?
From the root directory of the project. I donāt know if Snowpack gives any special treatment to folders with names like assets or src or public, as some other bundlers do.
Maybe the place to start would be visiting localhost:8080/assets/royal_esplanade_1k.hdr (or whatever port you need) to make sure your browser finds the file there, first? Keep in mind that URLs are relative to the HTML page, not the JS file in src/, when doing loader.load(...).
I figured out the problem. I installed an npm package that converted non-js packages into js(because that was supposed to help snowpack load raw files). I donāt need that package anymore.