Bundle analysis and monitoring

This commit is contained in:
adilallo
2025-10-07 17:08:57 -06:00
parent 2ed878af81
commit 104208c7df
15 changed files with 1554 additions and 46938 deletions
+19
View File
@@ -58,6 +58,25 @@ const nextConfig = {
use: ["@svgr/webpack"],
});
// Bundle analysis - only in production builds
if (process.env.ANALYZE === "true" && !dev) {
try {
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
reportFilename: isServer
? "../analyze/server.html"
: "../analyze/client.html",
})
);
} catch (error) {
console.warn("Bundle analyzer not available:", error.message);
}
}
// Production optimizations
if (!dev && !isServer) {
// Tree shaking optimization