forked from DustinBrett/daedalOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
65 lines (56 loc) · 1.58 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// @ts-check
const isProduction = process.env.NODE_ENV === "production";
const bundleAnalyzer = process.env.npm_config_argv?.includes(
"build:bundle-analyzer"
);
const webpack = require("webpack");
/**
* @type {import("next").NextConfig}
* */
const nextConfig = {
compiler: {
reactRemoveProperties: isProduction,
removeConsole: isProduction,
styledComponents: {
displayName: !isProduction,
minify: isProduction,
pure: true,
},
},
devIndicators: {
buildActivityPosition: "top-right",
},
optimizeFonts: false,
output: "export",
productionBrowserSourceMaps: false,
reactStrictMode: true,
swcMinify: true,
webpack: (config) => {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
const mod = resource.request.replace(/^node:/, "");
switch (mod) {
case "buffer":
resource.request = "buffer";
break;
case "stream":
resource.request = "readable-stream";
break;
default:
throw new Error(`Not found ${mod}`);
}
})
);
config.resolve.fallback = config.resolve.fallback || {};
config.resolve.fallback.module = false;
config.resolve.fallback.perf_hooks = false;
config.module.parser.javascript = config.module.parser.javascript || {};
config.module.parser.javascript.dynamicImportFetchPriority = "high";
return config;
},
};
module.exports = bundleAnalyzer
? require("@next/bundle-analyzer")({
enabled: isProduction,
})(nextConfig)
: nextConfig;