From 420c481b84881c7b20487434e627ebbd7195ff9b Mon Sep 17 00:00:00 2001 From: nalpari Date: Thu, 12 Jun 2025 17:36:45 +0900 Subject: [PATCH] chore: configure webpack for production optimization - Added a webpack configuration to utilize terser-webpack-plugin for minifying JavaScript files in production builds, ensuring no comments are included in the output. --- next.config.ts | 16 ++++++++++++++++ package.json | 1 + 2 files changed, 17 insertions(+) diff --git a/next.config.ts b/next.config.ts index c4728af..58db81e 100644 --- a/next.config.ts +++ b/next.config.ts @@ -19,6 +19,22 @@ const nextConfig: NextConfig = { // }, ] }, + webpack: (config, { dev, isServer }) => { + if (!dev && !isServer) { + config.optimization.minimizer = config.optimization.minimizer || [] + config.optimization.minimizer.push( + new (require('terser-webpack-plugin'))({ + terserOptions: { + format: { + comments: false, + }, + }, + extractComments: false, + }), + ) + } + return config + }, } export default nextConfig diff --git a/package.json b/package.json index 064f055..439c5df 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@types/react-dom": "^19", "prisma": "^6.7.0", "tailwindcss": "^4", + "terser-webpack-plugin": "^5.3.14", "typescript": "^5" } }