Skip to content

Commit 278cc78

Browse files
authored
Merge pull request #71 from Commencis/feature/bundle-analyzer
feat: add bundle analyzer
2 parents 3959e24 + f8224bf commit 278cc78

File tree

3 files changed

+133
-2
lines changed

3 files changed

+133
-2
lines changed

next.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import type { NextConfig } from 'next';
22
import createNextIntlPlugin from 'next-intl/plugin';
3+
import bundleAnalyzer from '@next/bundle-analyzer';
34

45
const withNextIntl = createNextIntlPlugin({
56
requestConfig: './src/lib/i18n/i18n.ts',
67
});
78

8-
const nextConfig: NextConfig = {
9+
const withBundleAnalyzer = bundleAnalyzer({
10+
enabled: process.env.ANALYZE === 'true',
11+
})
12+
13+
const baseConfig: NextConfig = {
914
poweredByHeader: false,
1015

1116
webpack(config) {
@@ -22,4 +27,7 @@ const nextConfig: NextConfig = {
2227
},
2328
};
2429

25-
export default withNextIntl(nextConfig);
30+
const intlConfig = withNextIntl(baseConfig);
31+
const analyzerConfig = withBundleAnalyzer(intlConfig);
32+
33+
export default analyzerConfig;

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"dev": "next dev",
1515
"build": "next build",
1616
"start": "next start",
17+
"analyze": "ANALYZE=true pnpm build",
1718
"lint:check:types": "tsc --noEmit",
1819
"lint:check:js": "eslint .",
1920
"lint:fix:js": "eslint . --fix",
@@ -29,6 +30,7 @@
2930
"precommit": "lint-staged"
3031
},
3132
"dependencies": {
33+
"@next/bundle-analyzer": "15.4.6",
3234
"axios": "1.11.0",
3335
"clsx": "2.1.1",
3436
"next": "15.4.6",

pnpm-lock.yaml

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)