From c4d4afd4dfa3d54d1dcbd3c64cfeba1a7173a4a1 Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 2 Sep 2024 16:45:48 +0300 Subject: [PATCH] deployment example (#126) Co-authored-by: Aslam H --- web/next.config.mjs | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) 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