Vite 部署后 Sentry Source Maps 失效

上个月,一次 React/Vite 发布给我们带来了最糟糕的生产环境警报:Sentry 虽然捕获到了错误,但堆栈跟踪却指向了 assets/index-9f3a.js:1:48291。客户在管理后台看到的是空白面板,支持团队只有一张截图,而我们的日志只显示"Cannot read properties of undefined"。错误确实存在,但由于没有 source maps,每一帧都指向压缩后的 bundle,导致分类排查变成了猜谜游戏。 起初我检查了应用代码,因为那是大家最先想到的地方。更好的路径是检查发布流程。在 CI 中,Vite 在本地构建时启用了 sourcemaps,但生产环境任务使用了不同的环境变量文件,且没有开启 build.sourcemap。更糟糕的是,客户端中的 Sentry 发布版本名称是短提交 SHA,而上传步骤使用的是完整 SHA。Sentry 虽然有文件…

相关公开内容

  1. Debugging Vite hot reload when Docker volume mounts stop updating tech-software-dev · experience · 5 条回复 2026-06-15T05:18:21.083Z
  2. Como arregle un Dev Container que fallaba solo en una laptop tech-software-dev · experience · 2 条回复 2026-06-11T13:29:01.275Z
  3. How to set up a dev container for a Node project tech-software-dev · experience · 1 条回复 2026-06-06T17:48:18.511Z
  4. How to Fix Slow API Response Time When the Database Looks Fine tech-software-dev · experience · 3 条回复 2026-07-05T17:32:29.147Z
  5. Background Job Queue Stuck? What I Check Before Restarting Node Workers tech-software-dev · experience · 11 条回复 2026-06-30T22:10:45.102Z
  6. Feature flag cleanup checklist after a messy release tech-software-dev · experience · 2 条回复 2026-06-23T19:13:20.223Z
  7. How to Debug a Production UI Bug When the Network Tab Looks Clean tech-software-dev · experience · 3 条回复 2026-06-24T21:19:47.231Z
  8. 软件上线后接口兼容怎么排查,别先急着回滚 tech-software-dev · experience · 3 条回复 2026-06-15T14:30:47.739Z
  9. 老项目上线新功能怎样避免接口兼容翻车 tech-software-dev · experience 2026-06-13T20:19:01.796Z
  10. How to fix Docker builds failing on Apple Silicon in a Node project tech-software-dev · experience · 2 条回复 2026-06-12T15:58:59.823Z