【问题标题】:Next.js in Vercel with Sentry - ignore source maps in productionVercel 中的 Next.js 与 Sentry - 在生产中忽略源映射
【发布时间】:2022-01-13 14:04:27
【问题描述】:

我正在 Vercel 中部署 Next.js 应用程序,并使用 @sentry/next.js 模块提供的 Sentry 配置。这是示例 repo - https://github.com/voronianski/test-next-sentry-app

它使用来自 Next.js 的官方示例(例如https://github.com/vercel/next.js/tree/canary/examples/with-sentry)。

与 Sentry 的集成完美运行。然而,我注意到一件让我烦恼的事情。 每个文件的源图都是公开的。

这是应用程序的链接 - https://test-next-sentry-app.vercel.app/,这是 _app.js 的地图文件 https://test-next-sentry-app.vercel.app/_next/static/chunks/pages/_app-b2c4ce59f737104d4ac1.js.map

这导致在浏览器开发工具中完全可见的项目结构和源代码 -

我尝试使用 .vercelignore 文件,但没有帮助 - https://github.com/voronianski/test-next-sentry-app/blob/main/.vercelignore

有没有办法在 Vercel 中不将源映射文件公开?谢谢!

【问题讨论】:

标签: javascript next.js sentry source-maps vercel


【解决方案1】:

考虑通过 CDN 与 vercel.app 域对您的应用程序进行前端处理

https://vercel.com/support/articles/using-cloudflare-with-vercel

Cloudflare 通过他们的团队计划免费提供基于 IP 的访问(不是公共用户),然后您可以将他们的 IP 访问规则添加到该路径的 IP 范围

https://developers.cloudflare.com/cloudflare-one/applications/configure-apps/self-hosted-apps

【讨论】:

    猜你喜欢
    • 2020-07-15
    • 1970-01-01
    • 2020-08-09
    • 2021-04-18
    • 2021-10-17
    • 2015-08-14
    • 2022-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多