From 18c4d135bd23f78a90253ed45c562cfefe3ba2bf Mon Sep 17 00:00:00 2001 From: tzhangchi Date: Tue, 27 Dec 2022 23:39:42 +0800 Subject: [PATCH] chore: add command `pnpm dev:ac` for faster api proxy mode --- package.json | 1 + packages/app/next.config.js | 22 ++++++++++++++++------ packages/app/package.json | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 614d000f56..12c09107dd 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "license": "MPL-2.0", "scripts": { "dev": "pnpm --filter=!@pathfinder/app build && pnpm --filter @pathfinder/app dev", + "dev:ac": "pnpm --filter=!@pathfinder/app build && pnpm --filter @pathfinder/app dev:ac", "build": " pnpm --filter=!@pathfinder/app build && pnpm --filter!=@pathfinder/data-services -r build", "export": "pnpm --filter @pathfinder/app export", "start": "pnpm --filter @pathfinder/app start", diff --git a/packages/app/next.config.js b/packages/app/next.config.js index b8b01158fe..eacd634a8d 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -31,12 +31,22 @@ const nextConfig = { }, // XXX not test yet rewrites: async () => { - return [ - { - source: '/api/:path*', - destination: 'http://100.77.180.48:11001/api/:path*', - }, - ]; + if (process.env.NODE_API_SERVER === 'ac') { + console.log('use ac server'); + return [ + { + source: '/api/:path*', + destination: 'http://100.85.73.88:12001/api/:path*', + }, + ]; + } else { + return [ + { + source: '/api/:path*', + destination: 'http://100.77.180.48:11001/api/:path*', + }, + ]; + } }, basePath: process.env.BASE_PATH, }; diff --git a/packages/app/package.json b/packages/app/package.json index 1ee7211f0c..430db2e181 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "scripts": { "dev": "next dev -p 8080", + "dev:ac": "NODE_API_SERVER=ac next dev -p 8080", "build": "next build", "export": "next export", "start": "next start",