70 lines
1.4 KiB
JavaScript
70 lines
1.4 KiB
JavaScript
let userConfig;
|
|
try {
|
|
userConfig = await import("./v0-user-next.config");
|
|
} catch (e) {
|
|
// ignore error
|
|
}
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// For Electron compatibility
|
|
output: process.env.ELECTRON_BUILD === 'true' ? 'export' : undefined,
|
|
distDir: '.next',
|
|
eslint: {
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
unoptimized: true,
|
|
},
|
|
devIndicators: {
|
|
buildActivity: false,
|
|
buildActivityPosition: 'bottom-right',
|
|
autoPrerender: false,
|
|
},
|
|
experimental: {
|
|
webpackBuildWorker: true,
|
|
parallelServerBuildTraces: true,
|
|
parallelServerCompiles: true,
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
headers: [
|
|
{
|
|
key: 'Content-Security-Policy',
|
|
value: "frame-ancestors 'self' https://espace.slm-lab.net https://connect.slm-lab.net"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
};
|
|
|
|
mergeConfig(nextConfig, userConfig);
|
|
|
|
function mergeConfig(nextConfig, userConfig) {
|
|
if (!userConfig) {
|
|
return;
|
|
}
|
|
|
|
for (const key in userConfig) {
|
|
if (
|
|
typeof nextConfig[key] === "object" &&
|
|
!Array.isArray(nextConfig[key])
|
|
) {
|
|
nextConfig[key] = {
|
|
...nextConfig[key],
|
|
...userConfig[key],
|
|
};
|
|
} else {
|
|
nextConfig[key] = userConfig[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
export default nextConfig;
|