From 80d5bfd7c0cffaebe0eb7dd1790babb186447344 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 15 Jun 2023 01:48:56 +0800 Subject: [PATCH] feat: add app dev mode --- app/components/home.tsx | 7 ++++++- package.json | 2 ++ src-tauri/tauri.conf.json | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 16650228..46fd78e8 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -94,9 +94,14 @@ const useHasHydrated = () => { const loadAsyncGoogleFont = () => { const linkEl = document.createElement("link"); + const proxyFontUrl = "/google-fonts"; + const remoteFontUrl = "https://fonts.googleapis.com"; + const googleFontUrl = + getClientConfig()?.buildMode === "export" ? remoteFontUrl : proxyFontUrl; linkEl.rel = "stylesheet"; linkEl.href = - "/google-fonts/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"; + googleFontUrl + + "/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"; document.head.appendChild(linkEl); }; diff --git a/package.json b/package.json index 2dcf0250..b7e920e3 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "start": "next start", "lint": "next lint", "export": "BUILD_MODE=export yarn build", + "export:dev": "BUILD_MODE=export yarn dev", + "app:dev": "yarn tauri dev", "prompts": "node ./scripts/fetch-prompts.mjs", "prepare": "husky install", "proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 728d92d8..9db5da43 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,14 +1,14 @@ { "$schema": "../node_modules/@tauri-apps/cli/schema.json", "build": { - "beforeBuildCommand": "yarn build", - "beforeDevCommand": "yarn dev", + "beforeBuildCommand": "yarn export", + "beforeDevCommand": "yarn export:dev", "devPath": "http://localhost:3000", "distDir": "../out" }, "package": { "productName": "chatgpt-next-web", - "version": "2.8" + "version": "2.8.1" }, "tauri": { "allowlist": {