Skip to content

fix(starter): use relative paths for audio and texture assets to support non-root deployments#45

Open
AkshatRaj00 wants to merge 1 commit into
facebook:mainfrom
AkshatRaj00:fix/starter-template-asset-base-paths
Open

fix(starter): use relative paths for audio and texture assets to support non-root deployments#45
AkshatRaj00 wants to merge 1 commit into
facebook:mainfrom
AkshatRaj00:fix/starter-template-asset-base-paths

Conversation

@AkshatRaj00

Copy link
Copy Markdown

Summary

Fixes #40 and closes #44.

The starter template generated by npm create @iwsdk@latest uses absolute paths for two assets:

// Before (broken on GitHub Pages / non-root base)
chimeSound: { url: '/audio/chime.mp3', ... }
webxr:      { url: '/textures/webxr.png', ... }

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 critical webxr.png texture never loads.

Interestingly, the GLTF assets in the same file already use the correct ./ relative form:

environmentDesk: { url: './gltf/environmentDesk/environmentDesk.gltf', ... }

This fix brings chime.mp3 and webxr.png in line with the same pattern.

Changes

packages/starter-assets/starter-template/src/index.template.ts

- url: '/audio/chime.mp3',
+ url: './audio/chime.mp3',

- url: '/textures/webxr.png',
+ url: './textures/webxr.png',

That's the entire change — 2 lines, zero risk of regression on local dev usage, and it immediately unblocks GitHub Pages deployments for every new user.

Testing

  • Verified the fix resolves 404s when serving from a subdirectory
  • Consistent with existing GLTF asset path style in the same file
  • No changes to runtime behavior for root-based deployments (/ 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.

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
@meta-cla

meta-cla Bot commented May 23, 2026

Copy link
Copy Markdown

Hi @AkshatRaj00!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented May 23, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Starter template asset paths break when deployed under a subdirectory (GitHub Pages / non-root base) Issues with the Get Started app

1 participant