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";
|
|
|
|
|
|
|
|
|
|
const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
|
|
|
|
enabled: isProduction,
|
|
|
|
|
});
|
|
|
|
|
|
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-03-01 21:02:05 -08:00
|
|
|
styledComponents: true,
|
|
|
|
|
},
|
2022-03-04 20:36:28 -08:00
|
|
|
devIndicators: {
|
|
|
|
|
buildActivity: false,
|
|
|
|
|
},
|
2022-02-21 21:16:19 -08:00
|
|
|
experimental: {
|
2022-03-04 20:36:28 -08:00
|
|
|
disablePostcssPresetEnv: true,
|
2022-02-21 21:16:19 -08:00
|
|
|
reactRoot: true,
|
2022-03-04 20:36:28 -08:00
|
|
|
swcFileReading: true,
|
2022-02-21 21:16:19 -08:00
|
|
|
},
|
2022-03-04 20:36:28 -08:00
|
|
|
optimizeFonts: false,
|
2021-06-26 23:39:01 -07:00
|
|
|
reactStrictMode: true,
|
2022-03-12 20:27:34 -08:00
|
|
|
swcMinify: !isProduction,
|
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}`);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
},
|
2021-01-02 23:30:32 -08:00
|
|
|
};
|
2021-06-19 22:39:49 -07:00
|
|
|
|
2022-03-12 20:27:34 -08:00
|
|
|
module.exports = withBundleAnalyzer(nextConfig);
|