Files
daedalOS/next.config.js

66 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-06-19 22:39:49 -07:00
// @ts-check
2022-03-12 20:27:34 -08:00
const isProduction = process.env.NODE_ENV === "production";
2022-06-26 12:52:02 -07:00
const bundleAnalyzer = process.env.npm_config_argv?.includes(
"build:bundle-analyzer"
);
2022-03-12 20:27:34 -08:00
2022-05-01 20:44:50 -07:00
const webpack = require("webpack");
2021-06-19 22:39:49 -07:00
/**
2022-03-16 21:52:31 -07:00
* @type {import("next").NextConfig}
2021-06-19 22:39:49 -07:00
* */
const nextConfig = {
2022-03-01 21:02:05 -08:00
compiler: {
2022-03-12 20:27:34 -08:00
reactRemoveProperties: isProduction,
removeConsole: isProduction,
2022-06-28 18:12:08 -07:00
styledComponents: {
displayName: !isProduction,
minify: isProduction,
pure: true,
},
2022-03-01 21:02:05 -08:00
},
2022-03-04 20:36:28 -08:00
devIndicators: {
2022-06-28 18:12:08 -07:00
buildActivityPosition: "top-right",
2022-03-04 20:36:28 -08:00
},
optimizeFonts: false,
2023-11-21 22:00:09 -08:00
output: "export",
2022-06-28 18:12:08 -07:00
productionBrowserSourceMaps: false,
reactStrictMode: true,
2023-09-21 23:20:42 -07:00
swcMinify: true,
2022-05-01 20:44:50 -07:00
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}`);
}
})
);
2023-08-29 21:55:37 -07:00
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";
2022-05-01 20:44:50 -07:00
return config;
},
2021-01-02 23:30:32 -08:00
};
2021-06-19 22:39:49 -07:00
2022-06-26 12:52:02 -07:00
module.exports = bundleAnalyzer
? require("@next/bundle-analyzer")({
enabled: isProduction,
})(nextConfig)
: nextConfig;