perf: optimize bundle and load times via dynamic CSS imports, Webpack vendor chunking, and conditional map loading.(peak male content)
Build and Release / release (push) Successful in 37s

This commit is contained in:
taDuc
2026-06-04 10:21:23 +07:00
parent fb816fca11
commit 6c509a6b54
6 changed files with 147 additions and 126 deletions
+33 -1
View File
@@ -27,11 +27,43 @@ const nextConfig: NextConfig = {
],
},
output: 'standalone',
webpack(config) {
webpack(config, { isServer }) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
if (!isServer) {
// Split heavy third-party vendor libraries into their own dedicated chunks
config.optimization.splitChunks.cacheGroups = {
...config.optimization.splitChunks.cacheGroups,
maplibre: {
test: /[\\/]node_modules[\\/]maplibre-gl[\\/]/,
name: "maplibre",
chunks: "all",
priority: 40,
},
quill: {
test: /[\\/]node_modules[\\/](react-quill-new|quill|quill-blot-formatter)[\\/]/,
name: "quill",
chunks: "all",
priority: 35,
},
charts: {
test: /[\\/]node_modules[\\/](apexcharts|react-apexcharts)[\\/]/,
name: "charts",
chunks: "all",
priority: 30,
},
calendar: {
test: /[\\/]node_modules[\\/]@fullcalendar[\\/]/,
name: "calendar",
chunks: "all",
priority: 25,
},
};
}
return config;
},