From d992e98d77d453a70f60ac8d2801af6f29b0ab3d Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Sat, 8 Nov 2025 20:32:06 -0600 Subject: [PATCH] feat: enable production source maps for easier debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added productionBrowserSourceMaps: true to Next.js config to enable source maps in production builds. This will make client-side errors much easier to debug by showing the original TypeScript source files and line numbers instead of minified JavaScript. Trade-off: Slightly larger build artifacts, but worth it for the improved debugging experience. Source maps are downloaded on-demand only when DevTools are open. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/next.config.js | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 2839ab23..aa6f9992 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -1,9 +1,12 @@ -const createNextIntlPlugin = require("next-intl/plugin"); +const createNextIntlPlugin = require('next-intl/plugin') -const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts"); +const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts') /** @type {import('next').NextConfig} */ const nextConfig = { + // Enable source maps in production for easier debugging + productionBrowserSourceMaps: true, + eslint: { ignoreDuringBuilds: true, }, @@ -11,16 +14,16 @@ const nextConfig = { ignoreBuildErrors: true, }, experimental: { - optimizePackageImports: ["@soroban/core", "@soroban/client"], - serverComponentsExternalPackages: ["@myriaddreamin/typst.ts"], + optimizePackageImports: ['@soroban/core', '@soroban/client'], + serverComponentsExternalPackages: ['@myriaddreamin/typst.ts'], }, - transpilePackages: ["@soroban/core", "@soroban/client"], + transpilePackages: ['@soroban/core', '@soroban/client'], webpack: (config, { isServer }) => { config.experiments = { ...config.experiments, asyncWebAssembly: true, layers: true, - }; + } // Optimize WASM loading if (!isServer) { @@ -34,37 +37,37 @@ const nextConfig = { // Create separate chunk for WASM modules wasm: { test: /\.wasm$/, - name: "wasm", - chunks: "async", + name: 'wasm', + chunks: 'async', enforce: true, }, // Separate typst.ts into its own chunk typst: { test: /[\\/]node_modules[\\/]@myriaddreamin[\\/]typst.*[\\/]/, - name: "typst", - chunks: "async", + name: 'typst', + chunks: 'async', enforce: true, }, }, }, - }; + } // Add preload hints for critical WASM files config.resolve.fallback = { ...config.resolve.fallback, fs: false, path: false, - }; + } } // Fix for WASM modules config.module.rules.push({ test: /\.wasm$/, - type: "asset/resource", - }); + type: 'asset/resource', + }) - return config; + return config }, -}; +} -module.exports = withNextIntl(nextConfig); +module.exports = withNextIntl(nextConfig)