-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
51 lines (43 loc) · 1.31 KB
/
next.config.js
File metadata and controls
51 lines (43 loc) · 1.31 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//@ts-check
const { composePlugins, withNx } = require("@nx/next");
/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Ensure Nx doesn't override our optimization settings
svgr: false,
},
// Disable code minimization and compression
optimization: {
compress: false,
minimize: false,
swcMinify: false,
},
// Ensure webpack doesn't minimize or compress
webpack: (config, { dev, isServer }) => {
// Disable minimization regardless of environment
config.optimization.minimize = false;
if (config.optimization.minimizer) {
config.optimization.minimizer = [];
}
return config;
},
};
// Define custom plugin to ensure optimization settings aren't overridden
const withNoMinimize = (nextConfig) => {
return {
...nextConfig,
webpack: (config, options) => {
// Call the user's webpack function if it exists
const userWebpack = nextConfig.webpack;
const resultConfig = userWebpack ? userWebpack(config, options) : config;
// Ensure minimization is disabled
resultConfig.optimization.minimize = false;
resultConfig.optimization.minimizer = [];
return resultConfig;
},
};
};
const plugins = [withNoMinimize, withNx];
module.exports = composePlugins(...plugins)(nextConfig);