feat: sourcemaps
This commit is contained in:
parent
2146bf626a
commit
bff204f036
|
|
@ -10,6 +10,17 @@ const nextConfig = {
|
|||
transpilePackages: ['crypto-hash'],
|
||||
// Enable production sourcemaps for Sentry
|
||||
productionBrowserSourceMaps: true,
|
||||
|
||||
// Custom webpack config to ensure sourcemaps are generated properly
|
||||
webpack: (config, { buildId, dev, isServer, defaultLoaders }) => {
|
||||
// Enable sourcemaps for both client and server in production
|
||||
if (!dev) {
|
||||
config.devtool = isServer ? 'source-map' : 'hidden-source-map';
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
|
@ -50,30 +61,48 @@ export default withSentryConfig(nextConfig, {
|
|||
project: process.env.SENTRY_PROJECT,
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
|
||||
// Sourcemap configuration
|
||||
// Sourcemap configuration optimized for monorepo
|
||||
sourcemaps: {
|
||||
disable: false, // Enable sourcemap upload (default: false)
|
||||
assets: ["**/*.js", "**/*.js.map"], // Files to upload
|
||||
ignore: ["**/node_modules/**"], // Exclude node_modules
|
||||
deleteSourcemapsAfterUpload: true, // Delete sourcemaps after upload for security
|
||||
disable: false,
|
||||
// More comprehensive asset patterns for monorepo
|
||||
assets: [
|
||||
".next/static/**/*.js",
|
||||
".next/static/**/*.js.map",
|
||||
".next/server/**/*.js",
|
||||
".next/server/**/*.js.map",
|
||||
],
|
||||
ignore: [
|
||||
"**/node_modules/**",
|
||||
"**/*hot-update*",
|
||||
"**/_buildManifest.js",
|
||||
"**/_ssgManifest.js",
|
||||
"**/*.test.js",
|
||||
"**/*.spec.js",
|
||||
],
|
||||
deleteSourcemapsAfterUpload: true,
|
||||
},
|
||||
|
||||
// Release configuration (optional but recommended)
|
||||
// Release configuration
|
||||
release: {
|
||||
create: true, // Create release in Sentry
|
||||
finalize: true, // Finalize release after build
|
||||
create: true,
|
||||
finalize: true,
|
||||
// Use git commit hash for releases in monorepo
|
||||
name: process.env.VERCEL_GIT_COMMIT_SHA || process.env.GITHUB_SHA || undefined,
|
||||
},
|
||||
|
||||
// NextJS specific optimizations for monorepo
|
||||
widenClientFileUpload: true,
|
||||
|
||||
// Additional configuration
|
||||
telemetry: false,
|
||||
silent: process.env.NODE_ENV === 'production', // Reduce build logs in production
|
||||
debug: process.env.NODE_ENV === 'development', // Enable debug in development
|
||||
silent: process.env.NODE_ENV === 'production',
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
|
||||
// Error handling for CI/CD
|
||||
errorHandler: (error) => {
|
||||
console.warn("Sentry build error occurred:", error);
|
||||
// Don't fail the build if Sentry upload fails
|
||||
// Remove the next line if you want builds to fail on Sentry errors
|
||||
console.warn("Sentry build error occurred:", error.message);
|
||||
console.warn("This might be due to missing Sentry environment variables or network issues");
|
||||
// Don't fail the build if Sentry upload fails in monorepo context
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"scripts": {
|
||||
"dev": "dotenv -e ../../.env -- next dev -p 4200",
|
||||
"build": "next build",
|
||||
"build:sentry": "dotenv -e ../../.env -- next build",
|
||||
"start": "dotenv -e ../../.env -- next start -p 4200",
|
||||
"pm2": "pm2 start pnpm --name frontend -- start"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue