build: enhance nx build (#2948)

This commit is contained in:
Alex Yang
2023-07-01 01:17:31 +08:00
parent d24009f494
commit d120f3ada8
27 changed files with 559 additions and 138 deletions

View File

@@ -53,24 +53,9 @@ const profileTarget = {
local: '127.0.0.1:3000',
};
const getRedirectConfig = profile => {
const target = profileTarget[profile || 'dev'] || profileTarget['dev'];
return [
[
{ source: '/api/:path*', destination: `http://${target}/api/:path*` },
{
source: '/collaboration/:path*',
destination: `http://${target}/collaboration/:path*`,
},
],
target,
profile || 'dev',
];
};
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
sentry: {
hideSourceMaps: true,
},
@@ -123,7 +108,6 @@ const nextConfig = {
serverAPI:
profileTarget[process.env.API_SERVER_PROFILE || 'dev'] ??
profileTarget.dev,
editorVersion: require('./package.json').dependencies['@blocksuite/editor'],
editorFlags: blockSuiteFeatureFlags,
...buildFlags,
},
@@ -162,13 +146,6 @@ const nextConfig = {
return config;
},
rewrites: async () => {
const [profile, target, desc] = getRedirectConfig(
process.env.API_SERVER_PROFILE
);
console.info(`API request proxy to [${desc} Server]: ` + target);
return profile;
},
basePath: process.env.NEXT_BASE_PATH,
assetPrefix: process.env.NEXT_ASSET_PREFIX,
pageExtensions: [