Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

639
Vistas
Next.js in Vercel with Sentry - ignore source maps in production

I'm deploying a Next.js app in Vercel with Sentry configuration provided by @sentry/next.js module. Here is the example repo - https://github.com/voronianski/test-next-sentry-app

It uses the official example from Next.js (e.g. https://github.com/vercel/next.js/tree/canary/examples/with-sentry).

Integration with Sentry works perfectly. However I noticed one thing that kind of bothers me. Source maps for each file are publicly available.

Here is the link to the app - https://test-next-sentry-app.vercel.app/ and here is the map file of _app.js https://test-next-sentry-app.vercel.app/_next/static/chunks/pages/_app-b2c4ce59f737104d4ac1.js.map

This leads to the completely visible project structure and source codes in the browser dev tools - dev tools screenshot

I tried to use .vercelignore file but it didn't help - https://github.com/voronianski/test-next-sentry-app/blob/main/.vercelignore

Is there a way to not deploy source map files to public in Vercel? Thanks!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

As suggested by Vercel support - you can use rewrites option in next.config.js to achieve this -

const nextConfig = {
  // ...
  rewrites: async () => {
    // do not leak source-maps in Vercel production deployments
    // but keep them in Vercel preview deployments with generated urls 
    // for better dev experience
    const isVercelProdDeploy = process.env.VERCEL_ENV === 'production';

    if (isVercelProdDeploy) {
      return {
        beforeFiles: [
          {
            source: '/:path*.map',
            destination: '/404'
          }
        ]
      };
    }

    return [];
  },
  // ...
};

module.exports = nextConfig;

https://nextjs.org/docs/api-reference/next.config.js/rewrites

about 4 years ago · Juan Pablo Isaza Denunciar

0

Consider fronting your application through a CDN vs the vercel.app domain

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

Cloudflare is free to a point for IP based access (not public users) through their teams plan and then you can add their IP Access rules to your IP Range for that path

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda