diff --git a/web/next.config.mjs b/web/next.config.mjs index 7b4993fe..f63ab4cd 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -1,5 +1,18 @@ /** @type {import('next').NextConfig} */ -const nextConfig = { + +const isTauri = process.env.TAURI_ENV_DEBUG !== undefined +const isProd = process.env.NODE_ENV === "production" +const internalHost = process.env.TAURI_DEV_HOST || "localhost" +const isIgnoreBuild = process.env.IGNORE_BUILD_ERRORS === "true" + +console.log(isIgnoreBuild) +const ignoreBuild = { + typescript: { + ignoreBuildErrors: true + } +} + +const commonConfig = { reactStrictMode: false, images: { remotePatterns: [ @@ -8,7 +21,27 @@ const nextConfig = { hostname: "**" } ] - } + }, + ...(isIgnoreBuild ? ignoreBuild : {}) } +const tauriConfig = { + ...commonConfig, + output: "export", + images: { + ...commonConfig.images, + unoptimized: true + }, + assetPrefix: isProd ? null : `http://${internalHost}:3000`, + ...ignoreBuild +} + +const webConfig = { + ...commonConfig +} + +const nextConfig = isTauri ? tauriConfig : webConfig + +console.log(`Using ${isTauri ? "Tauri" : "Web"} config`) + export default nextConfig