From ed1eead1c8343bd00680b4d36d0e47c1ce6ae50a Mon Sep 17 00:00:00 2001 From: Asuka109 Date: Thu, 9 Nov 2023 02:02:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20build:=20bump=20next.j?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 6 ++++-- package.json | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 4e44f41ed61dc..25b7875af0b6e 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,5 @@ +import nextPWA from '@ducanh2912/next-pwa'; import analyzer from '@next/bundle-analyzer'; -import nextPWA from 'next-pwa'; const isProd = process.env.NODE_ENV === 'production'; const buildWithDocker = process.env.DOCKER === 'true'; @@ -11,7 +11,9 @@ const withBundleAnalyzer = analyzer({ const withPWA = nextPWA({ dest: 'public', register: true, - skipWaiting: true, + workboxOptions: { + skipWaiting: true, + }, }); /** @type {import('next').NextConfig} */ diff --git a/package.json b/package.json index 691819ff120a1..40fbd5e7f0866 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "lucide-react": "latest", "modern-screenshot": "^4", "nanoid": "^5", - "next": "^13.5.3", + "next": "^14.0.1", "openai": "~4.15.0", "polished": "^4", "posthog-js": "^1", @@ -121,10 +121,11 @@ }, "devDependencies": { "@commitlint/cli": "^18", + "@ducanh2912/next-pwa": "^9.7.2", "@lobehub/i18n-cli": "latest", "@lobehub/lint": "latest", - "@next/bundle-analyzer": "^13", - "@next/eslint-plugin-next": "^13", + "@next/bundle-analyzer": "^14.0.1", + "@next/eslint-plugin-next": "^14.0.1", "@testing-library/jest-dom": "^6", "@testing-library/react": "^14", "@types/chroma-js": "^2", @@ -148,7 +149,6 @@ "lint-staged": "^15", "lodash": "^4", "markdown-table": "^3", - "next-pwa": "^5", "node-fetch": "^3", "prettier": "^3", "remark-cli": "^11", From a98faffc737a1c1c71faedfdf9e8e70a49789f1c Mon Sep 17 00:00:00 2001 From: Asuka109 Date: Thu, 9 Nov 2023 02:04:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20style:=20organize=20next=20c?= =?UTF-8?q?onfig=20to=20suppress=20eslint=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 25b7875af0b6e..8565730f17f84 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -19,49 +19,56 @@ const withPWA = nextPWA({ /** @type {import('next').NextConfig} */ const nextConfig = { compress: isProd, - reactStrictMode: true, + env: { + AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL ?? '', + PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL ?? '', + }, + experimental: { + forceSwcTransforms: true, + optimizePackageImports: [ + 'modern-screenshot', + 'emoji-mart', + '@emoji-mart/react', + '@emoji-mart/data', + '@icons-pack/react-simple-icons', + 'gpt-tokenizer', + 'chroma-js', + ], + webVitalsAttribution: ['CLS', 'LCP'], + }, images: { - unoptimized: !isProd, remotePatterns: [ { - protocol: 'https', hostname: 'registry.npmmirror.com', - port: '', pathname: '/@lobehub/assets-emoji/1.3.0/files/assets/**', + port: '', + protocol: 'https', }, { - protocol: 'https', hostname: 'registry.npmmirror.com', - port: '', pathname: '/@lobehub/assets-emoji-anim/1.0.0/files/assets/**', + port: '', + protocol: 'https', }, { - protocol: 'https', hostname: 'registry.npmmirror.com', - port: '', pathname: '/@lobehub/assets-logo/1.1.0/files/assets/**', + port: '', + protocol: 'https', }, { - protocol: 'https', hostname: 'registry.npmmirror.com', - port: '', pathname: '/@lobehub/assets-favicons/latest/files/assets/**', + port: '', + protocol: 'https', }, ], + unoptimized: !isProd, }, - experimental: { - webVitalsAttribution: ['CLS', 'LCP'], - forceSwcTransforms: true, - optimizePackageImports: [ - 'modern-screenshot', - 'emoji-mart', - '@emoji-mart/react', - '@emoji-mart/data', - '@icons-pack/react-simple-icons', - 'gpt-tokenizer', - 'chroma-js', - ], - }, + output: buildWithDocker ? 'standalone' : undefined, + + reactStrictMode: true, + transpilePackages: ['@lobehub/ui', 'antd-style', 'lodash-es'], webpack(config) { @@ -72,13 +79,6 @@ const nextConfig = { return config; }, - - env: { - AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL, - PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL, - }, - - output: buildWithDocker ? 'standalone' : undefined, }; export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig; From a689b96ff244a548ad92c00692c469effc4c525f Mon Sep 17 00:00:00 2001 From: Asuka109 Date: Thu, 9 Nov 2023 02:07:18 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20fix:=20ui=20flickering=20whe?= =?UTF-8?q?n=20using=20@ant-design/cssinjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index 8565730f17f84..1a971e8bdf137 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -77,6 +77,8 @@ const nextConfig = { layers: true, }; + config.resolve.alias['@ant-design/cssinjs'] = '@ant-design/cssinjs/lib'; + return config; }, }; From 4a3311d628f82dce42215b43e6ecd08c9197c567 Mon Sep 17 00:00:00 2001 From: Asuka109 Date: Thu, 9 Nov 2023 02:08:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20chore:?= =?UTF-8?q?=20suppress=20hydration=20warning=20by=20browser=20extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index df0ce298ae931..b665a65f4639d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -21,7 +21,7 @@ const RootLayout = ({ children }: PropsWithChildren) => { const lang = cookieStore.get(LOBE_LOCALE_COOKIE); return ( - +