Fix notification sounds failing to load in production builds#34
Merged
Fix notification sounds failing to load in production builds#34
Conversation
…older Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
Deploying classworks with
|
| Latest commit: |
d09d135
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://714f4f97.classworks.pages.dev |
| Branch Preview URL: | https://copilot-fix-notification-sou.classworks.pages.dev |
Copilot
AI
changed the title
[WIP] Fix bug preventing notification sound from loading after build
Fix notification sounds failing to load in production builds
Jan 18, 2026
Sunwuyuan
approved these changes
Jan 18, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where notification sounds failed to load in production builds. The root cause was that audio files in src/assets/sounds/ were not being copied to the production bundle, while the code referenced them using development-only paths. The solution relocates the audio files to the public/ directory and updates all path references accordingly.
Changes:
- Moved 35 audio files from
src/assets/sounds/topublic/sounds/for proper static asset handling - Updated path resolution from
/src/assets/sounds/to/sounds/in soundList.js, NotificationSoundSettings.vue, and the generation script - Updated code comments to reflect the new public directory approach
Reviewed changes
Copilot reviewed 3 out of 38 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/utils/soundList.js | Updated getSoundPath function to return /sounds/ path instead of /src/assets/sounds/ with updated comment |
| src/components/settings/NotificationSoundSettings.vue | Updated local getSoundPath method to use /sounds/ path with updated comment |
| scripts/generate-sound-list.js | Updated source directory path from ../src/assets/sounds to ../public/sounds and updated generated output path |
Comments suppressed due to low confidence (1)
src/components/settings/NotificationSoundSettings.vue:251
- This component defines its own getSoundPath method which duplicates the functionality already exported from soundList.js. Consider importing and using getSoundPath from soundList.js instead to maintain a single source of truth and avoid code duplication. The soundList.js file already exports this function, and other components like UrgentNotification.vue successfully use the imported version.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
此拉取请求已在 Kernyr 上被提及。那里可能有相关详细信息: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notification sounds were not loading after build because audio files in
src/assets/sounds/were not being copied to the production bundle, while the code referenced them using development-only paths (/src/assets/sounds/${filename}).Changes
Relocated audio assets: Moved 35 sound files from
src/assets/sounds/→public/sounds/public/are automatically copied to build output as static assetsUpdated path resolution:
export function getSoundPath(filename) { if (!filename) return null; - return `/src/assets/sounds/${filename}`; + return `/sounds/${filename}`; }Updated generation script: Modified
scripts/generate-sound-list.jsto read frompublic/sounds/Updated component: Fixed local path helper in
NotificationSoundSettings.vueSound files now work identically in both dev and production, accessible at
/sounds/*.mp3in all environments.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.