-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't load gltf file in production build #4953
Comments
Sorry maybe I just needed an online rubber duck because I found a rollup gltf loader https://github.com/bengsfort/rollup-plugin-gltf that I am going to try later. |
I tried rollup-plugin-gltf even though it wasn't on the list, it did not change the error message. Too bad because it's just a json file. |
Re |
@bluwy that was the issue, you solved my problem! Yes this was confusing because the built-in list I referenced was only an array of extensions. Thanks for your help and for addressing docs 🙌 |
Describe the bug
I'm attempting to acquire a dynamic url for a static asset that is a gltf file (the 3D file format). I get the gltf file url with
"new URL(`../../static/models/${shapeName}.gltf`, import.meta.url).href" and pass it to three.js GLTFLoader. This works nicely in development server. However, when I attempt to build the project, I get an error:
I tried to fix this by adding
assetsInclude: ['gltf']
to my config and this didn't help.I'm still pretty clueless about rollup and new to vite, but I thought maybe I needed the json plugin to load a different extension than json. The
include
option for the plugin says that it loads all files by default, confusing, but I assumed it meant all json files so I figured I could only narrow down that filter. Nonetheless, I tried addingjson({ include: ['*.json', '*.gltf'] })
to my plugins to no avail.I'm using vite to build an electron project based on this starter and the suggestion that it might be a good alternative to electron-webpack. Wow, it's doing a great job so I hope I can get over this hump so I can finally get my project into public here. Big thanks to devs / maintainers!
Reproduction
This may just be a matter of conceptual misunderstanding and the steps to reproduce manually are relatively simple. If this is not the case and it is deemed "need reproduction" I will put together a repo.
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: