feat: enable production source maps for easier debugging

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 <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-08 20:32:06 -06:00
parent 69f759a178
commit d992e98d77
1 changed files with 20 additions and 17 deletions

View File

@ -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} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
// Enable source maps in production for easier debugging
productionBrowserSourceMaps: true,
eslint: { eslint: {
ignoreDuringBuilds: true, ignoreDuringBuilds: true,
}, },
@ -11,16 +14,16 @@ const nextConfig = {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
experimental: { experimental: {
optimizePackageImports: ["@soroban/core", "@soroban/client"], optimizePackageImports: ['@soroban/core', '@soroban/client'],
serverComponentsExternalPackages: ["@myriaddreamin/typst.ts"], serverComponentsExternalPackages: ['@myriaddreamin/typst.ts'],
}, },
transpilePackages: ["@soroban/core", "@soroban/client"], transpilePackages: ['@soroban/core', '@soroban/client'],
webpack: (config, { isServer }) => { webpack: (config, { isServer }) => {
config.experiments = { config.experiments = {
...config.experiments, ...config.experiments,
asyncWebAssembly: true, asyncWebAssembly: true,
layers: true, layers: true,
}; }
// Optimize WASM loading // Optimize WASM loading
if (!isServer) { if (!isServer) {
@ -34,37 +37,37 @@ const nextConfig = {
// Create separate chunk for WASM modules // Create separate chunk for WASM modules
wasm: { wasm: {
test: /\.wasm$/, test: /\.wasm$/,
name: "wasm", name: 'wasm',
chunks: "async", chunks: 'async',
enforce: true, enforce: true,
}, },
// Separate typst.ts into its own chunk // Separate typst.ts into its own chunk
typst: { typst: {
test: /[\\/]node_modules[\\/]@myriaddreamin[\\/]typst.*[\\/]/, test: /[\\/]node_modules[\\/]@myriaddreamin[\\/]typst.*[\\/]/,
name: "typst", name: 'typst',
chunks: "async", chunks: 'async',
enforce: true, enforce: true,
}, },
}, },
}, },
}; }
// Add preload hints for critical WASM files // Add preload hints for critical WASM files
config.resolve.fallback = { config.resolve.fallback = {
...config.resolve.fallback, ...config.resolve.fallback,
fs: false, fs: false,
path: false, path: false,
}; }
} }
// Fix for WASM modules // Fix for WASM modules
config.module.rules.push({ config.module.rules.push({
test: /\.wasm$/, test: /\.wasm$/,
type: "asset/resource", type: 'asset/resource',
}); })
return config; return config
}, },
}; }
module.exports = withNextIntl(nextConfig); module.exports = withNextIntl(nextConfig)