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
|
|
|
|
2025-04-09 22:17:22 -07:00
|
|
|
const path = require("path");
|
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: {
|
2024-04-25 19:30:57 -07:00
|
|
|
displayName: false,
|
|
|
|
|
fileName: false,
|
2022-06-28 18:12:08 -07:00
|
|
|
minify: isProduction,
|
|
|
|
|
pure: true,
|
2024-07-15 21:34:18 -07:00
|
|
|
ssr: true,
|
2024-04-25 19:30:57 -07:00
|
|
|
transpileTemplateLiterals: true,
|
2022-06-28 18:12:08 -07:00
|
|
|
},
|
2022-03-01 21:02:05 -08:00
|
|
|
},
|
2025-02-27 00:14:22 -08:00
|
|
|
devIndicators: false,
|
2025-04-22 19:52:19 -07:00
|
|
|
headers: async () => [
|
|
|
|
|
{
|
|
|
|
|
source: "/:path*",
|
|
|
|
|
headers: [
|
|
|
|
|
{
|
|
|
|
|
key: "Cross-Origin-Opener-Policy",
|
|
|
|
|
value: "same-origin",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "Cross-Origin-Embedder-Policy",
|
|
|
|
|
value: "credentialless",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-11-21 22:00:09 -08:00
|
|
|
output: "export",
|
2022-06-28 18:12:08 -07:00
|
|
|
productionBrowserSourceMaps: false,
|
2025-03-14 19:30:59 -07:00
|
|
|
reactProductionProfiling: false,
|
|
|
|
|
reactStrictMode: !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}`);
|
|
|
|
|
}
|
2024-10-16 20:59:03 -07:00
|
|
|
}),
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__: "({ isDisabled: true })",
|
2022-05-01 20:44:50 -07:00
|
|
|
})
|
|
|
|
|
);
|
2023-08-29 21:55:37 -07:00
|
|
|
|
2025-04-09 22:17:22 -07:00
|
|
|
config.resolve.alias = config.resolve.alias || {};
|
|
|
|
|
config.resolve.alias["MediaInfoModule.wasm"] = path.resolve(
|
|
|
|
|
__dirname,
|
2025-06-08 19:58:25 -07:00
|
|
|
"public/System/mediainfo.js/MediaInfoModule.wasm"
|
2025-04-09 22:17:22 -07:00
|
|
|
);
|
|
|
|
|
|
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;
|