Fix notification sounds not loading after build by moving to public folder

Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-18 00:54:57 +00:00
co-authored by Sunwuyuan
parent e8014c499d
commit d09d135254
38 changed files with 10 additions and 10 deletions
@@ -242,9 +242,9 @@ export default {
getSoundPath(filename) {
if (!filename) return null;
try {
// 使用相对于public目录的路径,这样Vite不会在构建时打包所有音频
// 而是按需加载
return `/src/assets/sounds/${filename}`;
// 使用public目录路径,Vite会在构建时将public目录的文件复制到dist根目录
// 这样开发和生产环境都能正确加载音频文件
return `/sounds/${filename}`;
} catch {
return null;
}