Fix subpath asset URL resolution#256
Conversation
|
Too many files changed? Review this PR in Change Stack to see how the pieces fit before you dive in. Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR refactors how the application resolves asset and API URLs at runtime. Build-time ChangesRuntime base URL resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Motivation
/xm-player/) produced 404s for worklets, shaders, media and API fallbacks because many runtime asset URLs were built as root-relative paths. 404 HTML was being fed into WGSL compilation and AudioWorklet loading, causing runtime failures.Description
detectRuntimeBase()andwithBase()insrc/lib/paths.tsand switch URL construction to use those helpers instead of relying directly onimport.meta.env.BASE_URLwhen that value is/.hooks/useWorkletLoader.ts), JS/C++ worklet glue and native engine paths (audio-worklet/OpenMPTWorkletEngine.ts,hooks/useAudioGraph.ts,hooks/useLibOpenMPT.ts), shader loading and background shader loading (hooks/useWebGPURender.ts), compute shader (utils/computeNoteDuration.ts), bloom post-processor (components/PatternDisplay.tsx), thumbnails (components/ShaderSelectorPanel.tsx), remote media listing (utils/remoteMedia.ts), and storage API fallback handling (utils/storageApi.ts).processorOptions.baseUrland native engine initialization so the worklet can resolve its companion assets correctly.onSaveModulecallback to return aPromise<void>(App.tsx) to satisfy strict typing while preserving behavior.Testing
npm run typecheck(passed).npm run lint(project linter is currently a no-op; command exited 0).npm run buildand withVITE_APP_BASE_PATH=/xm-player/ npm run build(both completed successfully; Vite emitted an unrelated CSS minification warning aboutinst≈inset).node utils/__debug__/packingInvariants.test.cjs), but the test invocation usesnpx tsxand was blocked in this environment by a403 Forbiddenfrom the npm registry, so that debug script could not complete here.Codex Task
Summary by CodeRabbit