Skip to content

How to test components that use gltf files? #1318

Answered by drcmda
JBudny asked this question in Q&A
Discussion options

You must be logged in to vote

'./GLTFModels/Ground.gltf' can never work, that is a relative path, bundlers would not know what to do with that. think of it like this, your bundler is creating a distributable, it takes everything you reference and puts it into the /dist folder or bundles it together. your ground.gltf does not exist there, and you don't give it any clue that you need it. simply doing fetch('./model.gltf') does nothing, because './model.gltf' is just a string. three's loaders are using plain fetch, ergo your bundler is clueless, builds the app and when you load that file's missing.

  1. either put your model into /public and then refer to it absolutely "/models/name.gltf"
  2. or put it somewhere under /src and r…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@joshuaellis
Comment options

@drcmda
Comment options

@JBudny
Comment options

@drcmda
Comment options

@ashleymvanduzer
Comment options

Answer selected by JBudny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants