Skip to content

Commit ed61a54

Browse files
authored
feat: improving site loading metrics (#434)
1 parent a428721 commit ed61a54

File tree

71 files changed

+3565
-676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+3565
-676
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ yarn-error.log*
3333

3434
.env
3535
.codeassistant/mcp.json
36+
37+
# Circular dependency graphs
38+
circular-deps*.svg

.madgerc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"fileExtensions": ["js", "jsx", "ts", "tsx"],
3+
"excludeRegExp": [
4+
"node_modules",
5+
"dist",
6+
"build",
7+
".next",
8+
"out",
9+
"coverage",
10+
"\\.test\\.",
11+
"\\.spec\\.",
12+
"__tests__",
13+
"__mocks__"
14+
],
15+
"tsConfig": {
16+
"compilerOptions": {
17+
"module": "esnext",
18+
"moduleResolution": "bundler",
19+
"baseUrl": ".",
20+
"jsx": "preserve"
21+
}
22+
}
23+
}

next.config.js

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const {join} = require('path');
22
const path = require('path');
33

4+
const bundleAnalyzer = require('@next/bundle-analyzer');
5+
const {RsdoctorWebpackPlugin} = require('@rsdoctor/webpack-plugin');
46
const withPlugins = require('next-compose-plugins');
57
const {patchWebpackConfig} = require('next-global-css');
68
const withTM = require('next-transpile-modules')([
@@ -82,24 +84,56 @@ const plugins = [
8284
config.resolve.fallback.fs = false;
8385
}
8486

87+
if (process.env.ANALYZE_BUNDLE) {
88+
if (config.name === 'client') {
89+
config.plugins.push(
90+
new RsdoctorWebpackPlugin({
91+
disableClientServer: true,
92+
}),
93+
);
94+
} else if (config.name === 'server') {
95+
config.plugins.push(
96+
new RsdoctorWebpackPlugin({
97+
disableClientServer: true,
98+
output: {
99+
reportDir: './.next/server',
100+
},
101+
}),
102+
);
103+
}
104+
}
105+
85106
return config;
86107
},
87108
},
88109
],
89110
];
90111

91-
/** @type {import('next').NextConfig} */
92-
module.exports = withPlugins(plugins, {
93-
reactStrictMode: true,
94-
i18n: {
95-
locales: i18n.locales,
96-
defaultLocale: i18n.defaultLocale,
97-
localeDetection: false,
98-
},
99-
experimental: {
100-
esmExternals: 'loose',
101-
},
102-
assetPrefix: process.env.ASSET_PREFIX,
103-
crossOrigin: 'anonymous',
104-
output: process.env.IS_CONTAINER_BUILD ? 'standalone' : undefined,
112+
const withBundleAnalyzer = bundleAnalyzer({
113+
enabled: process.env.ANALYZE_BUNDLE === 'true',
105114
});
115+
116+
/** @type {import('next').NextConfig} */
117+
module.exports = withBundleAnalyzer(
118+
withPlugins(plugins, {
119+
reactStrictMode: true,
120+
i18n: {
121+
locales: i18n.locales,
122+
defaultLocale: i18n.defaultLocale,
123+
localeDetection: false,
124+
},
125+
experimental: {
126+
esmExternals: 'loose',
127+
optimizePackageImports: ['@gravity-ui/uikit'],
128+
},
129+
typescript: {
130+
ignoreBuildErrors: true,
131+
},
132+
eslint: {
133+
ignoreDuringBuilds: true,
134+
},
135+
assetPrefix: process.env.ASSET_PREFIX,
136+
crossOrigin: 'anonymous',
137+
output: process.env.IS_CONTAINER_BUILD ? 'standalone' : undefined,
138+
}),
139+
);

0 commit comments

Comments
 (0)