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.
This commit is contained in:
nalpari 2025-06-12 17:36:45 +09:00
parent 44d7a52790
commit 420c481b84
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -45,6 +45,7 @@
"@types/react-dom": "^19",
"prisma": "^6.7.0",
"tailwindcss": "^4",
"terser-webpack-plugin": "^5.3.14",
"typescript": "^5"
}
}