From e06078646b947db8dfee4e12f71a6d53ba986d6c Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Thu, 1 Sep 2022 18:00:54 +0800 Subject: [PATCH] Add asset prefix on export --- next.config.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 14bc4dd..0738868 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -18,6 +18,7 @@ /** * @type {import('next').NextConfig} */ +const isExport = process.env.NEXT_BUILD === 'export'; const nextConfig = { /* config options here */ reactStrictMode: true, @@ -25,11 +26,11 @@ const nextConfig = { experimental: { // runtime: 'nodejs', // outputStandalone: true, - images: - process.env.NEXT_BUILD === 'export' - ? { allowFutureImage: true, unoptimized: true } - : { allowFutureImage: true }, + images: isExport + ? { allowFutureImage: true, unoptimized: true } + : { allowFutureImage: true }, }, + assetPrefix: isExport ? './' : undefined, // images: // process.env.NEXT_BUILD === 'export' // ? {