fix(starter): use relative paths for audio and texture assets to support non-root deployments#45
Conversation
Previously, chime.mp3 and webxr.png used absolute paths (/audio/... and /textures/...) which broke deployments to GitHub Pages or any non-root base URL, causing 404 errors for all static assets. Changed to relative paths (./audio/... and ./textures/...) consistent with how the GLTF assets are already referenced in the same file. Fixes facebook#40, closes facebook#44
|
Hi @AkshatRaj00! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
Fixes #40 and closes #44.
The starter template generated by
npm create @iwsdk@latestuses absolute paths for two assets:When deployed to any subdirectory (e.g. GitHub Pages at
username.github.io/my-project/), these resolve to/audio/chime.mp3— missing the base path — and return a 404. The "Enter XR" experience silently breaks because the criticalwebxr.pngtexture never loads.Interestingly, the GLTF assets in the same file already use the correct
./relative form:This fix brings
chime.mp3andwebxr.pngin line with the same pattern.Changes
packages/starter-assets/starter-template/src/index.template.tsThat's the entire change — 2 lines, zero risk of regression on local
devusage, and it immediately unblocks GitHub Pages deployments for every new user.Testing
/base)Impact
This affects every first-time user who follows the Get Started guide and tries to share their experience via GitHub Pages. It's a high-visibility, low-risk fix that significantly improves the onboarding experience.