From 1bb4dd6374f3044b7e0eb7dbac1d1535e1650836 Mon Sep 17 00:00:00 2001 From: Joris Slagter Date: Mon, 8 Dec 2025 10:24:06 +0100 Subject: [PATCH] perf: add webpack production optimizations - Extract CSS to separate files for better caching - Split vendor chunks for optimized loading - Remove console.log statements in production builds - Disable source maps in production - Configure terser for better compression These optimizations should reduce bundle size and improve page load performance. --- nuxt.config.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nuxt.config.js b/nuxt.config.js index 1b939f3..5f62a2e 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -189,6 +189,32 @@ export default { /* ** You can extend webpack config here */ - extend(config, ctx) {}, + extractCSS: true, // Extract CSS into separate files + optimization: { + splitChunks: { + chunks: 'all', + automaticNameDelimiter: '.', + name: undefined, + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + priority: -10 + } + } + } + }, + terser: { + terserOptions: { + compress: { + drop_console: true // Remove console.log in production + } + } + }, + extend(config, ctx) { + // Disable source maps in production + if (!ctx.isDev) { + config.devtool = false + } + }, } }