Asset paths might be broken in builds
robfuscator opened this issue ยท 2 comments
Hey!
jspsych-builder
version: 4.3.0
I don't want to completely rule out the possibility that I have messed something up on my side, but I think I have discovered a bug. ๐
I'm using the new @assets
pragma to include images in my experiment:
/*
* @assets media/images
*/
While I'm developing using the integrated webpack-dev-server
, everything works fine. But when I export the experiment to either a zip to run directly in the browser or a jzip to import it to JATOS, the "compiled" asset paths seem to be broken. In both environments, the images are not displayed, but instead a symbol is signifying that they could not be found:
I'm not sure what might me causing this. The repo where this occurs is the following:
Edit: I accidentally sent the issue too early ๐คฆ
Hi @robfuscator,
thanks for providing the repo, very helpful! Luckily, this is jspsych-builder-unrelated: You should replace ../media/images/example-stimulus.jpg
with media/images/example-stimulus.jpg
. When loading the experiment via localhost, the browser resolves ../
to ./
because index.html
is already hosted at the topmost directory level. When using the build zip or JATOS, however, ../
moves one directory level up in the URL, where the files do not exist.
Cheers!
Well, you're absolutely right. Thanks for taking the time to help with my jspsych-builder
-unrelated problems. ๐ ๐