-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnext.config.js
37 lines (34 loc) · 1.05 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// See: https://kentcdodds.com/blog/profile-a-react-app-for-performance#build-and-measure-the-production-app
// See: https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
const { TerserPlugin } = require('next/dist/compiled/terser');
module.exports = {
future: {
webpack5: true,
},
webpack: (config, options) => {
//
// Use profiler-enabled React builds
//
config.resolve.alias = {
...config.resolve.alias,
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
};
//
// Disable mangling for easier profiling
// WARNING: This increases bundle size, DO NOT DO THIS in production!
//
const terser = config.optimization.minimizer.find(
(plugin) => typeof plugin.options !== 'undefined' && typeof plugin.options.terserOptions !== 'undefined'
);
if (terser) {
terser.options.terserOptions = {
...terser.options.terserOptions,
keep_classnames: true,
keep_fnames: true,
};
}
return config;
},
};